From 0e41b5d52fdc6af6442816b5f465c9db9f84e126 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:51:18 +0200 Subject: Adding upstream version 6.6.1+dfsg1. Signed-off-by: Daniel Baumann --- wp-includes/blocks/social-link.php | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'wp-includes/blocks/social-link.php') diff --git a/wp-includes/blocks/social-link.php b/wp-includes/blocks/social-link.php index 12c2904..da28034 100644 --- a/wp-includes/blocks/social-link.php +++ b/wp-includes/blocks/social-link.php @@ -8,6 +8,8 @@ /** * Renders the `core/social-link` block on server. * + * @since 5.4.0 + * * @param Array $attributes The block attributes. * @param String $content InnerBlocks content of the Block. * @param WP_Block $block Block object. @@ -17,10 +19,12 @@ function render_block_core_social_link( $attributes, $content, $block ) { $open_in_new_tab = isset( $block->context['openInNewTab'] ) ? $block->context['openInNewTab'] : false; - $service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon'; - $url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false; - $label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service ); - $rel = ( isset( $attributes['rel'] ) ) ? $attributes['rel'] : ''; + $text = ! empty( $attributes['label'] ) ? trim( $attributes['label'] ) : ''; + + $service = isset( $attributes['service'] ) ? $attributes['service'] : 'Icon'; + $url = isset( $attributes['url'] ) ? $attributes['url'] : false; + $text = $text ? $text : block_core_social_link_get_name( $service ); + $rel = isset( $attributes['rel'] ) ? $attributes['rel'] : ''; $show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false; // Don't render a link if there is no URL set. @@ -55,9 +59,8 @@ function render_block_core_social_link( $attributes, $content, $block ) { $link = '
  • '; $link .= ''; $link .= $icon; - $link .= ''; - $link .= esc_html( $label ); - $link .= '
  • '; + $link .= '' . esc_html( $text ) . ''; + $link .= ''; $processor = new WP_HTML_Tag_Processor( $link ); $processor->next_tag( 'a' ); @@ -72,6 +75,8 @@ function render_block_core_social_link( $attributes, $content, $block ) { /** * Registers the `core/social-link` blocks. + * + * @since 5.4.0 */ function register_block_core_social_link() { register_block_type_from_metadata( @@ -87,6 +92,8 @@ add_action( 'init', 'register_block_core_social_link' ); /** * Returns the SVG for social link. * + * @since 5.4.0 + * * @param string $service The service icon. * * @return string SVG Element for service icon. @@ -103,6 +110,8 @@ function block_core_social_link_get_icon( $service ) { /** * Returns the brand name for social link. * + * @since 5.4.0 + * * @param string $service The service icon. * * @return string Brand label. @@ -119,6 +128,8 @@ function block_core_social_link_get_name( $service ) { /** * Returns the SVG for social link. * + * @since 5.4.0 + * * @param string $service The service slug to extract data from. * @param string $field The field ('name', 'icon', etc) to extract for a service. * @@ -142,6 +153,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'Behance', 'icon' => '', ), + 'bluesky' => array( + 'name' => 'Bluesky', + 'icon' => '', + ), 'chain' => array( 'name' => 'Link', 'icon' => '', @@ -224,7 +239,7 @@ function block_core_social_link_services( $service = '', $field = '' ) { ), 'medium' => array( 'name' => 'Medium', - 'icon' => '', + 'icon' => '', ), 'patreon' => array( 'name' => 'Patreon', @@ -240,7 +255,7 @@ function block_core_social_link_services( $service = '', $field = '' ) { ), 'reddit' => array( 'name' => 'Reddit', - 'icon' => '', + 'icon' => '', ), 'share' => array( 'name' => 'Share Icon', @@ -332,6 +347,8 @@ function block_core_social_link_services( $service = '', $field = '' ) { /** * Returns CSS styles for icon and icon background colors. * + * @since 5.7.0 + * * @param array $context Block context passed to Social Link. * * @return string Inline CSS styles for link's icon and background colors. @@ -353,6 +370,8 @@ function block_core_social_link_get_color_styles( $context ) { /** * Returns CSS classes for icon and icon background colors. * + * @since 6.3.0 + * * @param array $context Block context passed to Social Sharing Link. * * @return string CSS classes for link's icon and background colors. -- cgit v1.2.3