Changeset 49135 for trunk/src/wp-includes/blocks/social-link.php
- Timestamp:
- 10/13/2020 01:07:23 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/social-link.php
r48177 r49135 9 9 * Renders the `core/social-link` block on server. 10 10 * 11 * @param array $attributes The block attributes. 11 * @param Array $attributes The block attributes. 12 * @param String $content InnerBlocks content of the Block. 13 * @param WPBlock $block Block object. 12 14 * 13 15 * @return string Rendered HTML of the referenced block. 14 16 */ 15 function render_block_core_social_link( $attributes ) { 17 function render_block_core_social_link( $attributes, $content, $block ) { 18 $open_in_new_tab = $block->context['openInNewTab']; 19 16 20 $service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon'; 17 21 $url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false; … … 24 28 } 25 29 30 $attribute = ''; 31 if ( $open_in_new_tab ) { 32 $attribute = 'rel="noopener nofollow" target="_blank"'; 33 } 34 26 35 $icon = block_core_social_link_get_icon( $service ); 27 return '<li class="wp-social-link wp-social-link-' . esc_attr( $service ) . esc_attr( $class_name ) . '"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" > ' . $icon . '</a></li>';36 return '<li class="wp-social-link wp-social-link-' . esc_attr( $service ) . esc_attr( $class_name ) . '"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" ' . $attribute . '> ' . $icon . '</a></li>'; 28 37 } 29 38
Note: See TracChangeset
for help on using the changeset viewer.