Skip to content

Commit

Permalink
Update social links block to output a custom class if it is present o…
Browse files Browse the repository at this point in the history
…n the individual social link items

Add comment explaining the MutationObserver stub in the storybook test
  • Loading branch information
brentswisher committed Mar 18, 2020
1 parent 476c4f6 commit 8754ef3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ function render_block_core_social_link( $attributes ) {
$attributes['label'] :
/* translators: %s: Social Link service name */
sprintf( __( 'Link to %s' ), block_core_social_link_get_name( $service ) );
$class_name = ( isset( $attributes['className'] ) ) ? ' ' . $attributes['className'] : false;

// Don't render a link if there is no URL set.
if ( ! $url ) {
return '';
}

$icon = block_core_social_link_get_icon( $service );
return '<li class="wp-social-link wp-social-link-' . esc_attr( $service ) . '"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '"> ' . $icon . '</a></li>';
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>';
}

/**
Expand Down

0 comments on commit 8754ef3

Please sign in to comment.