this was
// mouse-only and announced as "✕" or nothing at all.
return sprintf(
'
',
esc_attr__('Dismiss this notice', 'addons-for-divi')
);
}
return '';
}
/**
* Server-side render for the InlineNotice module.
*
* Mirrors the D4 markup:
*
* [figure]
[title][desc]
[dismiss]
*
*
* @param array $attrs Block attributes.
* @param string $content Block content (unused).
* @param WP_Block $block Parsed block.
* @param ModuleElements $elements Module elements helper.
*
* @return string
*/
public static function render_callback($attrs, $content, $block, $elements)
{
$advanced = $attrs['module']['advanced'] ?? [];
$alert_type = $advanced['alertType']['desktop']['value'] ?? 'danger';
$figure = self::render_figure($attrs);
$title = $elements->render(['attrName' => 'title']);
$desc = $elements->render(['attrName' => 'content']);
$dismiss = self::render_dismiss($attrs);
$children = sprintf(
'
',
esc_attr($alert_type),
$figure,
$title,
$desc,
$dismiss
);
return Module::render(
[
'attrs' => $attrs,
'elements' => $elements,
'id' => $block->parsed_block['id'],
'name' => $block->block_type->name,
'moduleCategory' => $block->block_type->category,
'classnamesFunction' => [self::class, 'module_classnames'],
'stylesComponent' => [self::class, 'module_styles'],
'scriptDataComponent' => [self::class, 'module_script_data'],
'orderIndex' => $block->parsed_block['orderIndex'] ?? 0,
'storeInstance' => $block->parsed_block['storeInstance'] ?? null,
'children' => [
// Background pattern/mask and the box-shadow overlay are DOM,
// not CSS. Without this call Divi renders them in the builder
// and nowhere else, so the options silently do nothing on the
// front end.
$elements->style_components(['attrName' => 'module']),
$children,
],
]
);
}
}