You are here

function gutenberg_render_core_social_link in Gutenberg 8

Renders the `core/social-link` block on server.

Parameters

array $attributes The block attributes.:

Return value

string Rendered HTML of the referenced block.

1 string reference to 'gutenberg_render_core_social_link'
gutenberg_register_block_core_social_link in vendor/gutenberg/block-library/blocks/social-link.php
Registers the `core/social-link` blocks.

File

vendor/gutenberg/block-library/blocks/social-link.php, line 15

Code

function gutenberg_render_core_social_link($attributes) {
  $site = isset($attributes['site']) ? $attributes['site'] : 'Icon';
  $url = isset($attributes['url']) ? $attributes['url'] : false;

  // Don't render a link if there is no URL set.
  if (!$url) {
    return '';
  }
  $icon = gutenberg_core_social_link_get_icon($site);
  return '<li class="wp-social-link wp-social-link-' . $site . '"><a href="' . esc_url($url) . '"> ' . $icon . '</a></li>';
}