*
[title]
* [children]
*
*
* @param array $attrs Block attributes.
* @param string $content Rendered child rows.
* @param object $block Parsed block.
* @param object $elements Module elements helper.
*
* @return string
*/
public static function render_callback($attrs, $content, $block, $elements)
{
$show_title = ($attrs['module']['advanced']['showTitle']['desktop']['value'] ?? 'on') === 'on';
// An empty title box still took its 25px Title Spacing (and any title
// padding or border) with nothing to show (#112). Divi 4 printed it
// too; skip it unless the title has visible text.
$title_html = '';
if ($show_title && TextValue::any_visible($attrs['title']['innerContent'] ?? [])) {
$title_html = sprintf(
'%1$s
',
$elements->render(['attrName' => 'title'])
);
}
$hours_html = sprintf(
'',
$title_html,
$content
);
return Module::render(
[
'orderIndex' => $block->parsed_block['orderIndex'] ?? 0,
'storeInstance' => $block->parsed_block['storeInstance'] ?? null,
'id' => $block->parsed_block['id'],
'name' => $block->block_type->name,
'moduleCategory' => $block->block_type->category,
'attrs' => $attrs,
'elements' => $elements,
'classnamesFunction' => [self::class, 'module_classnames'],
'stylesComponent' => [self::class, 'module_styles'],
'scriptDataComponent' => [self::class, 'module_script_data'],
'children' => [
$elements->style_components(['attrName' => 'module']),
$hours_html,
],
]
);
}
}