*/
private const LABEL_INLINE_TAGS = [
'strong' => [],
'em' => [],
];
/**
* Renders the block.
*
* @param array $attributes Block attributes.
* @param string $content Rendered content.
* @return string Block HTML.
*/
public function render(array $attributes, string $content): string {
return sprintf(
'
',
get_block_wrapper_attributes(Anchor::wrapperAttributes($attributes)),
self::label($attributes),
$content
);
}
/**
* The tab's label, safe to print. Also used for the Tabs block's tab bar.
*
* @param array $attributes Tab block attributes.
* @return string The label, or "Tab" when it is empty.
*/
public static function label(array $attributes): string {
$label = trim(wp_kses((string) ($attributes['label'] ?? ''), self::LABEL_INLINE_TAGS));
return $label !== '' ? $label : esc_html__('Tab', 'codexa-blocks');
}
}