'data-icon', 'tablet' => 'data-icon-tablet', 'phone' => 'data-icon-phone'] as $breakpoint => $attr_name) { $settings = $button_attr[$breakpoint]['value']['icon']['settings'] ?? null; // Only a well-formed icon value produces an attribute. Divi core // fatals on a malformed one (a responsive-wrapped scalar where it // expects a string) rather than ignoring it, so do not pass junk on. if (empty($settings) || !is_array($settings)) { continue; } $glyph = \ET\Builder\Packages\IconLibrary\IconFont\Utils::escape_font_icon( \ET\Builder\Packages\IconLibrary\IconFont\Utils::process_font_icon($settings) ); if ('' === $glyph || null === $glyph) { continue; } $out .= sprintf(' %1$s="%2$s"', $attr_name, esc_attr($glyph)); } return $out; } /** * Render a single button anchor. * * @param string $text Button text. * @param string $link Button URL. * @param string $target Link target (`_self`|`_blank`). * @param string $modifier Button modifier class (`primary`|`secondary`). * @param array $button_attr The button's `decoration.button` attr array. * * @return string */ public static function render_button($text, $link, $target, $modifier, $button_attr = []) { return sprintf( '%4$s', esc_attr($modifier), esc_url($link), esc_attr($target), et_core_esc_previously($text), self::button_icon_attrs($button_attr) ); } /** * Render the optional connector between the two buttons. * * @param array $advanced The `module.advanced` attrs array. * * @return string */ public static function render_connector($advanced) { $connector_type = $advanced['connectorType']['desktop']['value'] ?? 'empty'; if ('empty' === $connector_type) { return ''; } $inner = ''; if ('text' === $connector_type) { $inner = esc_html($advanced['connectorText']['desktop']['value'] ?? ''); } elseif ('icon' === $connector_type) { $icon_raw = $advanced['connectorIcon']['desktop']['value'] ?? ''; if (is_array($icon_raw)) { $uni = $icon_raw['unicode'] ?? ''; $type = $icon_raw['type'] ?? 'divi'; $weight = $icon_raw['weight'] ?? '400'; } else { $parts = explode('||', (string) $icon_raw); $uni = $parts[0] ?? ''; $type = $parts[1] ?? 'divi'; $weight = $parts[2] ?? '400'; } if ('' !== $uni) { $font = 'fa' === $type ? 'FontAwesome' : 'ETmodules'; if (function_exists('dtq_inject_fa_icons')) { // Reconstruct the legacy string form so the FA detector // (which expects "unicode||type||weight") works for both shapes. dtq_inject_fa_icons($uni . '||' . $type . '||' . $weight); } // dtq_resolve_icon_unicode() escapes its return value; entities // such as "àXX;" survive intact so the glyph still renders. $inner = sprintf( '%3$s', esc_attr($font), esc_attr($weight), dtq_resolve_icon_unicode($uni) ); } } return sprintf( '
%2$s
', esc_attr($connector_type), $inner ); } /** * Emit gap, alignment, and connector CSS as an inline '; } /** * The module's order class, exactly as Divi prints it on the wrapper. * * The inline