: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'' !== $current_text_size ? sprintf( 'font-size:%1$s !important;', $current_text_size ) : '',
'' !== $current_letter_spacing ? sprintf( 'letter-spacing:%1$s;', $current_letter_spacing ) : '',
'' !== $current_text_color ? sprintf( 'color:%1$s !important;', $current_text_color ) : '',
'' !== $current_border_width ? sprintf( 'border-width:%1$s !important;', $current_border_width ) : '',
'' !== $current_border_color ? sprintf( 'border-color:%1$s;', $current_border_color ) : '', // #5
'' !== $current_border_radius ? sprintf( 'border-radius:%1$s;', $current_border_radius ) : '',
'' !== $current_font ? et_builder_set_element_font( $current_font, true ) : '',
'' !== $responsive_padding_right ?
sprintf( 'padding-right: %1$s%2$s;',
$responsive_padding_right,
$main_element_styles_padding_important ? ' !important' : ''
'' !== $responsive_padding_left ?
sprintf( 'padding-left: %1$s%2$s;',
$responsive_padding_left,
$main_element_styles_padding_important ? ' !important' : ''
if ( ! empty( $responsive_button_declaration ) ) {
self::set_style( $function_name, array(
'selector' => $css_element_processed,
'declaration' => $responsive_button_declaration,
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// Responsive button hover declaration.
$responsive_button_hover_declaration = trim( sprintf(
'' !== $responsive_hover_padding_right ?
sprintf( 'padding-right: %1$s%2$s;',
$responsive_hover_padding_right,
$main_element_styles_padding_important ? ' !important' : ''
'' !== $responsive_hover_padding_left ?
sprintf( 'padding-left: %1$s%2$s;',
$responsive_hover_padding_left,
$main_element_styles_padding_important ? ' !important' : ''
// Responsive button hover styles.
if ( ! empty( $responsive_button_hover_declaration ) ) {
self::set_style( $function_name, array(
'selector' => $css_element_processed . ':hover',
'declaration' => $responsive_button_hover_declaration,
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// Responsive button after styles.
if ( 'off' !== $button_use_icon ) {
$current_icon_code = '' !== $current_icon ? str_replace( ';', '', str_replace( '&#x', '', html_entity_decode( et_pb_process_font_icon( $current_icon ) ) ) ) : '';
// 1. Set button color, line-height, font-size, and icon placement.
$responsive_button_after_declaration = trim( sprintf(
'' !== $current_icon_color ? sprintf( 'color:%1$s;', $current_icon_color ) : '',
'' !== $current_icon_code ? 'line-height: inherit;' : '',
'' !== $current_icon_code ? 'font-size: inherit !important;' : '',
'off' !== $current_on_hover && '' !== $current_icon_code ?
sprintf( 'margin-left: %1$s; %2$s: auto;',
'left' === $current_icon_placement ? '-1.3em' : '-1em',
'left' === $current_icon_placement ? 'right' : 'left'
'off' === $current_on_hover ?
sprintf( 'margin-left: %1$s; %2$s: auto;',
'left' === $current_icon_placement ? '-1.3em' : '.3em',
'left' === $current_icon_placement ? 'right' : 'left'
'' !== $current_icon_placement && in_array( $button_use_icon , array( 'default', 'on' ) ) ? 'display: inline-block;' : '',
'off' !== $current_on_hover ? 'opacity: 0;' : 'opacity: 1;'
if ( ! empty( $responsive_button_after_declaration ) ) {
self::set_style( $function_name, array(
'selector' => $css_element_processed . $button_icon_pseudo_selector,
'declaration' => $responsive_button_after_declaration,
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// 2. DONE - Set custom icon and icon placement.
if ( '' !== $current_icon_code ) {
$button_icon_suffix = $prev_icon !== $current_icon ? "-{$device}" : '';
$button_icon_content = "content: attr(data-icon{$button_icon_suffix});";
$button_side_hide = ':before';
$button_side_display = ':after';
// Reverse icon position.
if ( 'left' === $current_icon_placement ) {
$button_side_hide = ':after';
$button_side_display = ':before';
self::set_style( $function_name, array(
'selector' => $css_element_processed . $button_side_hide,
'declaration' => 'display: none;',
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
self::set_style( $function_name, array(
'selector' => $css_element_processed . $button_side_display,
'declaration' => $button_icon_content . ' font-family: "ETmodules" !important;',
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// 3. If button has default icon/hover/placement and disabled globally or not enabled in module then
// no :after:hover css should be generated.
if ( ! ( '' === $current_icon && $is_default_hover_placement ) && ( 'default' !== $button_use_icon || 'no' !== $global_use_icon_value ) ) {
$hover_after_styles = sprintf(
'' !== $current_icon_code ?
sprintf( 'margin-left:%1$s;', '35' !== $current_icon_code ? '.3em' : '0' )
'' !== $current_icon_code ?
sprintf( '%1$s: auto; margin-left: %2$s;',
'left' === $current_icon_placement ? 'right' : 'left',
'left' === $current_icon_placement ? '-1.3em' : '.3em'
'off' !== $current_on_hover ? 'opacity: 1;' : ''
self::set_style( $function_name, array(
'selector' => $css_element_processed . ':hover' . $button_icon_pseudo_selector,
'declaration' => rtrim( $hover_after_styles ),
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// Set button icon font size for default.
if ( '' === $current_icon && '' !== $current_text_size ) {
$default_icons_size = '1.6em';
$custom_icon_size = $current_text_size;
self::set_style( $function_name, array(
'selector' => $css_element_processed . $button_icon_pseudo_selector,
'declaration' => sprintf( 'font-size:%1$s;', $default_icons_size ),
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
self::set_style( $function_name, array(
'selector' => 'body.et_button_custom_icon #page-container ' . $css_element . $button_icon_pseudo_selector,
'declaration' => sprintf( 'font-size:%1$s;', $custom_icon_size ),
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
// Set button icon font size on hover for default.
if ( '' === $current_icon && '' !== $button_icon && '' !== $button_text_size_hover_processed ) {
$default_icons_size = '1.6em';
$custom_icon_size = $button_text_size_hover_processed;
self::set_style( $function_name, array(
'selector' => $css_element_processed . ':hover' . $button_icon_pseudo_selector,
'declaration' => sprintf( 'font-size:%1$s;', $default_icons_size ),
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
self::set_style( $function_name, array(
'selector' => 'body.et_button_custom_icon #page-container ' . $css_element . ':hover' . $button_icon_pseudo_selector,
'declaration' => sprintf( 'font-size:%1$s;', $custom_icon_size ),
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
$prev_icon = $current_icon;
// Place to store processed background. It will be compared with the smaller device
// background processed value to avoid rendering the same styles.
$processed_background_color = '';
$processed_background_image = '';
$gradient_properties_desktop = '';
$processed_background_blend = '';
// Store background images status because the process is extensive.
$background_image_status = array(
$background_color_gradient_overlays_image_desktop = 'off';
// Background Options Styling.
foreach ( et_pb_responsive_options()->get_modes() as $device ) {
$background_base_name = "{$option_name}_bg";
$background_prefix = "{$background_base_name}_";
$is_desktop = 'desktop' === $device;
$suffix = ! $is_desktop ? "_{$device}" : '';
$background_color_style = '';
$background_image_style = '';
$background_images = array();
$has_background_color_gradient = false;
$has_background_image = false;
$has_background_gradient_and_image = false;
$is_background_color_gradient_disabled = false;
$is_background_image_disabled = false;
$background_color_gradient_overlays_image = 'off';
// Ensure responsive is active.
if ( ! $is_desktop && ! et_pb_responsive_options()->is_responsive_enabled( $this->props, "{$option_name}_bg_color" ) ) {
// A. Background Gradient.
$use_background_color_gradient = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}use_color_gradient", $device, $background_base_name, $this->fields_unprocessed );
if ( 'on' === $use_background_color_gradient ) {
$background_color_gradient_overlays_image = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_overlays_image{$suffix}", '', true );
$gradient_properties = array(
'type' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_type{$suffix}", '', true ),
'direction' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_direction{$suffix}", '', true ),
'radial_direction' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_direction_radial{$suffix}", '', true ),
'color_start' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_start{$suffix}", '', true ),
'color_end' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_end{$suffix}", '', true ),
'start_position' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_start_position{$suffix}", '', true ),
'end_position' => et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}color_gradient_end_position{$suffix}", '', true ),
// Will be used as hover default.
if ( 'desktop' === $device ) {
$gradient_properties_desktop = $gradient_properties;
$background_color_gradient_overlays_image_desktop = $background_color_gradient_overlays_image;
// Save background gradient into background images list.
$background_images[] = $this->get_gradient( $gradient_properties );
// Flag to inform BG Color if current module has Gradient.
$has_background_color_gradient = true;
} else if ( 'off' === $use_background_color_gradient ) {
$is_background_color_gradient_disabled = true;
$background_image = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}image", $device, $background_base_name, $this->fields_unprocessed );
$parallax = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}parallax{$suffix}", 'off' );
// BG image and parallax status.
$is_background_image_active = '' !== $background_image && 'on' !== $parallax;
$background_image_status[ $device ] = $is_background_image_active;
if ( $is_background_image_active ) {
// Flag to inform BG Color if current module has Image.
$has_background_image = true;
// Check previous BG image status. Needed to get the correct value.
$is_prev_background_image_active = true;
$is_prev_background_image_active = 'tablet' === $device ? $background_image_status['desktop'] : $background_image_status['tablet'];
$background_size_default = self::$_->array_get( $this->fields_unprocessed, "{$background_prefix}size.default", '' );
$background_size = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}size{$suffix}", $background_size_default, ! $is_prev_background_image_active );
if ( '' !== $background_size ) {
$background_style .= sprintf(
'background-size: %1$s; ',
esc_html( $background_size )
$background_position_default = self::$_->array_get( $this->fields_unprocessed, "{$background_prefix}position.default", '' );
$background_position = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}position{$suffix}", $background_position_default, ! $is_prev_background_image_active );
if ( '' !== $background_position ) {
$background_style .= sprintf(
'background-position: %1$s; ',
esc_html( str_replace( '_', ' ', $background_position ) )
$background_repeat_default = self::$_->array_get( $this->fields_unprocessed, "{$background_prefix}repeat.default", '' );
$background_repeat = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}repeat{$suffix}", $background_repeat_default, ! $is_prev_background_image_active );
if ( '' !== $background_repeat ) {
$background_style .= sprintf(
'background-repeat: %1$s; ',
esc_html( $background_repeat )
$background_blend_default = self::$_->array_get( $this->fields_unprocessed, "{$background_prefix}blend.default", '' );
$background_blend = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}blend{$suffix}", $background_blend_default, ! $is_prev_background_image_active );
$background_blend_inherit = et_pb_responsive_options()->get_any_value( $this->props, "{$background_prefix}blend{$suffix}", '', true );
if ( '' !== $background_blend_inherit ) {
// Don't print the same image blend style.
if ( '' !== $background_blend ) {
$background_style .= sprintf(
'background-blend-mode: %1$s; ',
esc_html( $background_blend )
// Reset - If background has image and gradient, force background-color: initial.
if ( $has_background_color_gradient && $has_background_image && $background_blend_inherit !== $background_blend_default ) {
$has_background_gradient_and_image = true;
$background_color_style = 'initial';
$background_style .= 'background-color: initial; ';
$processed_background_blend = $background_blend;
// Only append background image when the image is exist.
$background_images[] = sprintf( 'url(%1$s)', esc_html( $background_image ) );
} else if ( '' === $background_image ) {
// Reset - If background image is disabled, ensure we reset prev background blend mode.
if ( '' !== $processed_background_blend ) {
$background_style .= 'background-blend-mode: normal; ';
$processed_background_blend = '';
$is_background_image_disabled = true;
if ( ! empty( $background_images ) ) {
// The browsers stack the images in the opposite order to what you'd expect.
if ( 'on' !== $background_color_gradient_overlays_image ) {
$background_images = array_reverse( $background_images );
// Set background image styles only it's different compared to the larger device.
$background_image_style = join( ', ', $background_images );
if ( $processed_background_image !== $background_image_style ) {
$background_style .= sprintf(
'background-image: %1$s !important;',
esc_html( $background_image_style )
} else if ( ! $is_desktop && $is_background_color_gradient_disabled && $is_background_image_disabled ) {
// Reset - If background image and gradient are disabled, reset current background image.
$background_image_style = 'initial';
$background_style .= 'background-image: initial !important;';
// Save processed background images.
$processed_background_image = $background_image_style;
if ( ! $has_background_gradient_and_image ) {
// Background color `initial` was added by default to reset button background
// color when user disable it on mobile preview mode. However, it should
// be applied only when the background color is really disabled because user
// may use theme customizer to setup global button background color. We also
// need to ensure user still able to disable background color on mobile.
$background_color_enable = self::$_->array_get( $this->props, "{$background_prefix}enable_color{$suffix}", '' );
$background_color_initial = 'off' === $background_color_enable && ! $is_desktop ? 'initial' : '';
$background_color = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}color", $device, $background_base_name, $this->fields_unprocessed );
$background_color = '' !== $background_color ? $background_color : $background_color_initial;
$background_color_style = $background_color;
if ( '' !== $background_color && $processed_background_color !== $background_color ) {
$background_style .= sprintf(
'background-color: %1$s%2$s; ',
esc_html( $background_color ),
// Save processed background color.
$processed_background_color = $background_color_style;
// Print background gradient and image styles.
if ( '' !== $background_style ) {
$background_style_attrs = array(
'selector' => $css_element_processed,
'declaration' => rtrim( $background_style ),
'priority' => $this->_style_priority,
// Add media query attribute to background style attrs.
if ( 'desktop' !== $device ) {
$current_media_query = 'tablet' === $device ? 'max_width_980' : 'max_width_767';
$background_style_attrs['media_query'] = ET_Builder_Element::get_media_query( $current_media_query );
self::set_style( $function_name, $background_style_attrs );
if ( et_builder_is_hover_enabled( "{$option_name}_bg_color", $this->props ) ) {
$background_base_name = "{$option_name}_bg";
$background_prefix = "{$background_base_name}_";
$background_images_hover = array();
$background_hover_style = '';
$has_background_color_gradient_hover = false;
$has_background_image_hover = false;
$has_background_gradient_and_image_hover = false;
$is_background_color_gradient_hover_disabled = false;
$is_background_image_hover_disabled = false;
$background_color_gradient_overlays_image_hover = 'off';
// Background Gradient Hover.
// This part is little bit different compared to other hover implementation. In
// this case, hover is enabled on the background field, not on the each of those
// fields. So, built in function get_value() doesn't work in this case.
// Temporarily, we need to fetch the the value from get_raw_value().
$use_background_color_gradient_hover = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}use_color_gradient", 'hover', $background_base_name, $this->fields_unprocessed );
if ( 'on' === $use_background_color_gradient_hover ) {
// Desktop value as default.
$background_color_gradient_type_desktop = self::$_->array_get( $gradient_properties_desktop, 'type', '' );
$background_color_gradient_direction_desktop = self::$_->array_get( $gradient_properties_desktop, 'direction', '' );
$background_color_gradient_radial_direction_desktop = self::$_->array_get( $gradient_properties_desktop, 'radial_direction', '' );
$background_color_gradient_color_start_desktop = self::$_->array_get( $gradient_properties_desktop, 'color_start', '' );
$background_color_gradient_color_end_desktop = self::$_->array_get( $gradient_properties_desktop, 'color_end', '' );
$background_color_gradient_start_position_desktop = self::$_->array_get( $gradient_properties_desktop, 'start_position', '' );
$background_color_gradient_end_position_desktop = self::$_->array_get( $gradient_properties_desktop, 'end_position', '' );
$background_color_gradient_type_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_type", $this->props, $background_color_gradient_type_desktop );
$background_color_gradient_direction_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_direction", $this->props, $background_color_gradient_direction_desktop );
$background_color_gradient_direction_radial_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_direction_radial", $this->props, $background_color_gradient_radial_direction_desktop );
$background_color_gradient_start_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_start", $this->props, $background_color_gradient_color_start_desktop );
$background_color_gradient_end_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_end", $this->props, $background_color_gradient_color_end_desktop );
$background_color_gradient_start_position_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_start_position", $this->props, $background_color_gradient_start_position_desktop );
$background_color_gradient_end_position_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_end_position", $this->props, $background_color_gradient_end_position_desktop );
$background_color_gradient_overlays_image_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}color_gradient_overlays_image", $this->props, $background_color_gradient_overlays_image_desktop );
$has_background_color_gradient_hover = true;
$gradient_values_hover = array(
'type' => '' !== $background_color_gradient_type_hover ? $background_color_gradient_type_hover : $background_color_gradient_type_desktop,
'direction' => '' !== $background_color_gradient_direction_hover ? $background_color_gradient_direction_hover : $background_color_gradient_direction_desktop,
'radial_direction' => '' !== $background_color_gradient_direction_radial_hover ? $background_color_gradient_direction_radial_hover : $background_color_gradient_radial_direction_desktop,
'color_start' => '' !== $background_color_gradient_start_hover ? $background_color_gradient_start_hover : $background_color_gradient_color_start_desktop,
'color_end' => '' !== $background_color_gradient_end_hover ? $background_color_gradient_end_hover : $background_color_gradient_color_end_desktop,
'start_position' => '' !== $background_color_gradient_start_position_hover ? $background_color_gradient_start_position_hover : $background_color_gradient_start_position_desktop,
'end_position' => '' !== $background_color_gradient_end_position_hover ? $background_color_gradient_end_position_hover : $background_color_gradient_end_position_desktop,
$background_images_hover[] = $this->get_gradient( $gradient_values_hover );
} else if ( 'off' === $use_background_color_gradient_hover ) {
$is_background_color_gradient_hover_disabled = true;
// Background Image Hover.
// This part is little bit different compared to other hover implementation. In
// this case, hover is enabled on the background field, not on the each of those
// fields. So, built in function get_value() doesn't work in this case.
// Temporarily, we need to fetch the the value from get_raw_value().
$background_image_hover = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}image", 'hover', $background_base_name, $this->fields_unprocessed );
$parallax_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}parallax", $this->props );
if ( '' !== $background_image_hover && null !== $background_image_hover && 'on' !== $parallax_hover ) {
// Flag to inform BG Color if current module has Image.
$has_background_image_hover = true;
$background_size_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}size", $this->props );
$background_size_desktop = self::$_->array_get( $this->props, "{$background_prefix}size", '' );
$is_same_background_size = $background_size_hover === $background_size_desktop;
if ( empty( $background_size_hover ) && ! empty( $background_size_desktop ) ) {
$background_size_hover = $background_size_desktop;
if ( ! empty( $background_size_hover ) && ! $is_same_background_size ) {