render(['attrName' => 'button']): on Divi 5.9.0 that path emits * nothing for a button declared as a nested element, which is reproducible * with Divi's own pricing-tables-item and so is not specific to our * metadata. The attribute keeps its divi/button decoration group, so the * Design tab still styles this anchor through the selector in module.json. * * @param array $attrs Block attributes. * @param string $content Block content (unused; no children). * @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'] ?? []; $button_html = ButtonElement::render( $attrs['button'] ?? [], 'dtq-btn-default dtq-creative-btn__link', [ // The label lives in its own span so the text-slide-up effect can // move it independently of the anchor. 'children' => sprintf( '%s', et_core_esc_previously((string) DynamicValue::resolve($attrs['button']['innerContent']['desktop']['value']['text'] ?? '')) ), ] ); // Only the Slide Up Text effect reads this, and it lands in CSS through // attr() — esc_attr keeps it inside the attribute. $hover_text = (string) ($advanced['hoverText']['desktop']['value'] ?? ''); $hover_attr = '' !== $hover_text ? sprintf(' data-dtq-hover-text="%s"', esc_attr($hover_text)) : ''; $children = sprintf( '
%3$s
', esc_attr(self::wrapper_class($advanced)), $hover_attr, $button_html ); 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' => [ $elements->style_components(['attrName' => 'module']), $children, ], ] ); } }