: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @since 3.23 Add responsive settings support to render tablet and phone styles.
* @param ET_Builder_Element $module Module object.
* @param string $label Label.
* @param array $font Field definition.
* @param string $function_name Shortcode function.
* @param bool $is_hover Hover status.
* @param string $device Current active device.
public function update_styles( $module, $label, $font, $function_name, $is_hover = false, $device = 'desktop' ) {
$utils = ET_Core_Data_Utils::instance();
$all_values = $module->props;
$main_element_selector = $module->main_css_element;
$device = '' === $device ? 'desktop' : $device;
// Use a different selector for plugin
$css_element = $this->is_plugin_active && isset( $font['css']['limited_main'] ) ? 'css.limited_main' : 'css.main';
// Use 'text_shadow' selector if defined, fallback to $css_element or default selector
$selector = $utils->array_get( $font, 'css.text_shadow', $utils->array_get( $font, $css_element, $main_element_selector ) );
$responsive_selector = $selector;
if ( is_array( $selector ) ) {
$selector = array_map( array( $this, 'add_hover_to_selectors' ), $selector );
$selector = et_pb_hover_options()->add_hover_to_selectors( $selector );
$selector = $utils->array_get( $font, 'css.text_shadow_hover', $utils->array_get( $font, 'css.hover', $selector ) );
// Get the text-shadow declaration (horizontal vertical blur color).
$declaration = $this->get_declaration(
$this->get_important( $font, 'text-shadow' ),
// Do not provide hover style if it is the same as normal style
$normal = $this->get_declaration(
$this->get_important( $font, 'text-shadow' ),
if ( $declaration === $normal ) {
if ( 'desktop' !== $device && ! $is_hover ) {
$breakpoint = 'tablet' === $device ? 'max_width_980' : 'max_width_767';
$media_query = array( 'media_query' => ET_Builder_Element::get_media_query( $breakpoint ) );
if ( is_array( $selector ) ) {
foreach ( $selector as $single_selector ) {
ET_Builder_Element::set_style(
$function_name, array_merge( array(
'selector' => $single_selector,
'declaration' => $declaration,
'priority' => $module->get_style_priority(),
ET_Builder_Element::set_style(
$function_name, array_merge( array(
'declaration' => $declaration,
'priority' => $module->get_style_priority(),
* Added to fix array_map can't access static class of Hover Options.
* @param string $selector Current selector.
* @return string Updated selector with hover suffix.
private function add_hover_to_selectors( $selector ) {
return et_pb_hover_options()->add_hover_to_selectors( $selector );
* Process Text Shadow options and adds CSS rules.
* @param ET_Builder_Element $module Module object.
* @param string $function_name Shortcode function.
public function process_advanced_css( $module, $function_name ) {
$utils = ET_Core_Data_Utils::instance();
$all_values = $module->props;
$advanced_fields = $module->advanced_fields;
// Disable if module doesn't set advanced_fields property and has no VB support
if ( ! $module->has_vb_support() && ! $module->has_advanced_fields ) {
$suffixes = array( '', 'tablet', 'phone', et_pb_hover_options()->get_suffix() );
foreach ( $suffixes as $suffix ) {
$is_hover = et_pb_hover_options()->get_suffix() === $suffix;
// Check for text shadow settings in font-options
if ( ! empty( $advanced_fields['fonts'] ) ) {
// We have a 'fonts' section, fetch its values
foreach ( $advanced_fields['fonts'] as $label => $font ) {
// label can be header / body / toggle / etc
$shadow_style = "{$label}_text_shadow_style";
if ( 'none' !== $utils->array_get( $all_values, $shadow_style, 'none' ) ) {
// We have a preset selected which isn't none, need to add text-shadow style
$this->update_styles( $module, $label, $font, $function_name, $is_hover, $suffix, $label );
// Check for text shadow settings in Advanced/Text toggle
if ( isset( $advanced_fields['text'] ) && 'none' !== $utils->array_get( $all_values, 'text_shadow_style', 'none' ) ) {
// We have a preset selected which isn't none, need to add text-shadow style
$text = $advanced_fields['text'];
$this->update_styles( $module, '', $text, $function_name, $is_hover, $suffix );
// Check for text shadow settings in Advanced/Fields toggle
if ( isset( $advanced_fields['fields'] ) && 'none' !== $utils->array_get( $all_values, 'fields_text_shadow_style', 'none' ) ) {
// We have a preset selected which isn't none, need to add text-shadow style
$fields = $advanced_fields['fields'];
$this->update_styles( $module, 'fields', $fields, $function_name, $is_hover, $suffix );
// Check for text shadow settings in Advanced/Button toggle
if ( ! empty( $advanced_fields['button'] ) ) {
// We have a 'button' section, fetch its values
foreach ( $advanced_fields['button'] as $label => $button ) {
// label can be header / body / toggle / etc
$shadow_style = "{$label}_text_shadow_style";
if ( 'none' !== $utils->array_get( $all_values, $shadow_style, 'none' ) ) {
// We have a preset selected which isn't none, need to add text-shadow style
// Build a selector to only target the button
$css_element = $utils->array_get( $button, 'css.main', "{$module->main_css_element} .et_pb_button" );
// Make sure it has highest priority
$utils->array_set( $button, 'css.text_shadow', $css_element );
if ( ! isset( $button['css.hover'] ) ) {
$utils->array_set( $button, 'css.hover', et_pb_hover_options()->add_hover_to_selectors( $css_element ) );
$this->update_styles( $module, $label, $button, $function_name, $is_hover, $suffix );
// Check for text shadow settings in Advanced/Fields Input toggle
if ( ! empty( $advanced_fields['form_field'] ) ) {
// There are possibilities to have more than one field inputs.
foreach ( $advanced_fields['form_field'] as $label => $form_field ) {
// Ensure the text shadow style is selected before updating the styles.
if ( 'none' !== $utils->array_get( $all_values, $label . '_text_shadow_style', 'none' ) ) {
// Build a selector to only target the field input.
$main_selector = isset( $form_field['css']['main'] ) ? $form_field['css']['main'] : "{$module->main_css_element} .input";
$text_shadow_selector = isset( $form_field['css']['text_shadow'] ) ? $form_field['css']['text_shadow'] : $main_selector;
$text_shadow_hover_selector = isset( $form_field['css']['text_shadow_hover'] ) ? $form_field['css']['text_shadow_hover'] : et_pb_hover_options()->add_hover_to_selectors( $text_shadow_selector );
// Make sure it has highest priority.
$form_field['css']['text_shadow'] = $text_shadow_selector;
$form_field['css']['text_shadow_hover'] = $text_shadow_hover_selector;
// Check and override important status.
if ( ! empty( $form_field['css']['important'] ) ) {
$form_field_important = $form_field['css']['important'];
if ( ! empty( $form_field_important['font'] ) ) {
$form_field['css']['important'] = $form_field_important['font'];
if ( ! empty( $form_field_important['text_shadow'] ) ) {
$form_field['css']['important'] = $form_field_important['text_shadow'];
$this->update_styles( $module, $label, $form_field, $function_name, $is_hover, $suffix );
}//end process_advanced_css()
return new ET_Builder_Module_Field_TextShadow();