render_block_core_widget_group() – Renders the ‘core/widget-group’ block.

You appear to be a bot. Output may be restricted

Description

Renders the 'core/widget-group' block.

Usage

$string = render_block_core_widget_group( $attributes, $content, $block );

Parameters

$attributes
( array ) required – The block attributes.
$content
( string ) required – The block content.
$block
( WP_Block ) required – The block.

Returns

string Rendered block.

Source

File name: wordpress/wp-includes/blocks/widget-group.php


Lines:

1 to 26 of 26
function render_block_core_widget_group( $attributes, $content, $block ) {
  global $wp_registered_sidebars, $_sidebar_being_rendered;

  if ( isset( $wp_registered_sidebars[ $_sidebar_being_rendered ] ) ) {
    $before_title = $wp_registered_sidebars[ $_sidebar_being_rendered ]['before_title'];
    $after_title  = $wp_registered_sidebars[ $_sidebar_being_rendered ]['after_title'];
  } else {
    $before_title = '<h2 class="widget-title">';
    $after_title  = '</h2>';
  }

  $html = '';

  if ( ! empty( $attributes['title'] ) ) {
    $html .= $before_title . $attributes['title'] . $after_title;
  }

  $html .= '<div class="wp-widget-group__inner-blocks">';
  foreach ( $block->inner_blocks as $inner_block ) {
    $html .= $inner_block->render();
  }
  $html .= '</div>';

  return $html;
}
 

 View on GitHub View on Trac