Skip to content

Commit

Permalink
Update social link attribute checks to use array_key_exists
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Nov 6, 2020
1 parent 6f8441d commit ceb9458
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/
function render_block_core_social_link( $attributes, $content, $block ) {
$open_in_new_tab = $block->context['openInNewTab'];
$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 );
$class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;
$service = array_key_exists( 'service', $attributes ) ? $attributes['service'] : 'Icon';
$url = array_key_exists( 'url', $attributes ) ? $attributes['url'] : false;
$label = array_key_exists( 'label', $attributes ) ? $attributes['label'] : block_core_social_link_get_name( $service );
$class_name = array_key_exists( 'className', $attributes ) ? ' ' . $attributes['className'] : false;

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

0 comments on commit ceb9458

Please sign in to comment.