Make WordPress Core


Ignore:
Timestamp:
03/02/2021 12:44:06 AM (4 years ago)
Author:
noisysocks
Message:

Editor: Update @wordpress npm packages

Update @wordpress npm packages to the latest published versions. This includes
block editor bug fixes for WordPress 5.7 RC 2.

Fixes #52680.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.7/src/wp-includes/blocks/social-link.php

    r50137 r50467  
    3434
    3535    $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    );
    3742
    3843    return '<li ' . $wrapper_attributes . '><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" ' . $attribute . ' class="wp-block-social-link-anchor"> ' . $icon . '</a></li>';
     
    281286    return $services_data;
    282287}
     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 */
     296function 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.