Changeset 50467 for branches/5.7/src/wp-includes/blocks/social-link.php
- Timestamp:
- 03/02/2021 12:44:06 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.7/src/wp-includes/blocks/social-link.php
r50137 r50467 34 34 35 35 $icon = block_core_social_link_get_icon( $service ); 36 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'wp-social-link wp-social-link-' . $service . $class_name ) ); 36 $wrapper_attributes = get_block_wrapper_attributes( 37 array( 38 'class' => 'wp-social-link wp-social-link-' . $service . $class_name, 39 'style' => block_core_social_link_get_color_styles( $block->context ), 40 ) 41 ); 37 42 38 43 return '<li ' . $wrapper_attributes . '><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" ' . $attribute . ' class="wp-block-social-link-anchor"> ' . $icon . '</a></li>'; … … 281 286 return $services_data; 282 287 } 288 289 /** 290 * Returns CSS styles for icon and icon background colors. 291 * 292 * @param array $context Block context passed to Social Link. 293 * 294 * @return string Inline CSS styles for link's icon and background colors. 295 */ 296 function block_core_social_link_get_color_styles( $context ) { 297 $styles = array(); 298 299 if ( array_key_exists( 'iconColorValue', $context ) ) { 300 $styles[] = 'color: ' . $context['iconColorValue'] . '; '; 301 } 302 303 if ( array_key_exists( 'iconBackgroundColorValue', $context ) ) { 304 $styles[] = 'background-color: ' . $context['iconBackgroundColorValue'] . '; '; 305 } 306 307 return implode( '', $styles ); 308 }
Note: See TracChangeset
for help on using the changeset viewer.