__NAMESPACE__ . '\load_assets', 'uses_context' => array( 'showSubscribeButton', 'openLinksNewWindow' ), ) ); } add_action( 'init', __NAMESPACE__ . '\register_block' ); /** * Blogroll Item block registration/dependency declaration. * * @param array $attr Array containing the Blogroll Item block attributes. * @param string $content String containing the block content. * @param object $block The block. * * @return string */ function load_assets( $attr, $content, $block ) { /* * Enqueue necessary scripts and styles. */ Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME ); $name = esc_attr( $attr['name'] ); $url = esc_url( $attr['url'] ); $description = esc_attr( $attr['description'] ); $icon = esc_attr( $attr['icon'] ); $target = $block->context['openLinksNewWindow'] ? '_blank' : '_self'; if ( empty( $icon ) ) { $icon = 'https://s0.wp.com/i/webclip.png'; } $content = << $name
$name
$description
HTML; return sprintf( '
%2$s
', esc_attr( Blocks::classes( FEATURE_NAME, $attr ) ), $content ); }