: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$additional_options = array();
'max_width' => 'MaxWidth',
foreach ( $features as $name => $fields_name ) {
if ( $this->has_vb_support() ) {
$this->advanced_fields[ $name ] = self::$_->array_get( $this->advanced_fields, $name, array() );
} else if ( ! $this->has_advanced_fields ) {
if ( ! is_array( self::$_->array_get( $this->advanced_fields, $name ) ) ) {
$extra = self::$_->array_get( $this->advanced_fields[ $name ], 'extra', array() );
$fields = array_merge( array( '' => $this->advanced_fields[ $name ] ), $extra );
foreach ( $fields as $prefix => $settings ) {
$prefix = et_builder_add_prefix( $prefix, '' );
$tab_slug = isset( $settings['tab_slug'] ) ? $settings['tab_slug'] : 'advanced';
$toggle_slug = isset( $settings['toggle_slug'] ) ? $settings['toggle_slug'] : 'width';
$toggle_title = isset( $settings['toggle_title'] ) ? $settings['toggle_title'] : et_builder_i18n( 'Sizing' );
$toggle_priority = isset( $settings['toggle_priority'] ) ? $settings['toggle_priority'] : 80;
$settings['prefix'] = $prefix;
$this->_add_settings_modal_toggles( $tab_slug,
'title' => $toggle_title,
'priority' => $toggle_priority,
$additional_options = array_merge(
ET_Builder_Module_Fields_Factory::get( $fields_name )->get_fields( $settings )
// Allow module to configure specific options
if ( isset( $settings['options'] ) && is_array( $settings['options'] ) ) {
foreach ( $settings['options'] as $option_slug => $options ) {
if ( ! is_array( $options ) ) {
foreach ( $options as $option_name => $option_value ) {
$additional_options[ $prefix . $option_slug ][ $option_name ] = $option_value;
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
public function _add_max_width_fields() {
protected function _add_overflow_fields() {
if ( is_array( self::$_->array_get( $this->advanced_fields, 'overflow', array() ) ) ) {
$defaultOverflow = self::$_->array_get( $this->advanced_fields, 'overflow.default', ET_Builder_Module_Helper_Overflow::OVERFLOW_DEFAULT );
$this->_additional_fields_options = array_merge(
$this->_additional_fields_options,
ET_Builder_Module_Fields_Factory::get( 'Overflow' )->get_fields( array( 'default' => $defaultOverflow ) )
public function get_scroll_effects_options() {
if ( ! isset( $i18n['motion'] ) ) {
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
'label' => __( 'Vertical Motion', 'et_builder' ),
'description' => __( 'Give this element vertical motion so that is moves faster or slower than the elements around it as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Offset', 'et_builder' ),
'middleValueTitle' => __( 'Mid Offset', 'et_builder' ),
'endValueTitle' => __( 'Ending Offset', 'et_builder' ),
'label' => __( 'Horizontal Motion', 'et_builder' ),
'description' => __( 'Give this element horizontal motion so that it slides left or right as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Offset', 'et_builder' ),
'middleValueTitle' => __( 'Mid Offset', 'et_builder' ),
'endValueTitle' => __( 'Ending Offset', 'et_builder' ),
'label' => __( 'Fading In and Out', 'et_builder' ),
'description' => __( 'Give this element an opacity effect so that it fades in and out as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Opacity', 'et_builder' ),
'middleValueTitle' => __( 'Mid Opacity', 'et_builder' ),
'endValueTitle' => __( 'Ending Opacity', 'et_builder' ),
'label' => __( 'Scaling Up and Down', 'et_builder' ),
'description' => __( 'Give this element a scale effect so that it grows and shrinks as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Scale', 'et_builder' ),
'middleValueTitle' => __( 'Mid Scale', 'et_builder' ),
'endValueTitle' => __( 'Ending Scale', 'et_builder' ),
'label' => __( 'Rotating', 'et_builder' ),
'description' => __( 'Give this element rotating motion so that it spins as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Rotation', 'et_builder' ),
'middleValueTitle' => __( 'Mid Rotation', 'et_builder' ),
'endValueTitle' => __( 'Ending Rotation', 'et_builder' ),
'label' => __( 'Blur', 'et_builder' ),
'description' => __( 'Give this element a blur effect so that it moves in and out of focus as the viewer scrolls through the page.', 'et_builder' ),
'startValueTitle' => __( 'Starting Blur', 'et_builder' ),
'middleValueTitle' => __( 'Mid Blur', 'et_builder' ),
'endValueTitle' => __( 'Ending Blur', 'et_builder' ),
"${prefix}vertical_motion" => array(
'label' => $i18n['motion']['vertical']['label'],
'description' => $i18n['motion']['vertical']['description'],
'startValueTitle' => $i18n['motion']['vertical']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['vertical']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['vertical']['endValueTitle'],
'icon' => 'vertical-motion',
'resolver' => 'translateY',
'default' => '0|50|50|100|4|0|-4',
"{$prefix}horizontal_motion" => array(
'label' => $i18n['motion']['horizontal']['label'],
'description' => $i18n['motion']['horizontal']['description'],
'startValueTitle' => $i18n['motion']['horizontal']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['horizontal']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['horizontal']['endValueTitle'],
'icon' => 'horizontal-motion',
'resolver' => 'translateX',
'default' => '0|50|50|100|4|0|-4',
"{$prefix}fade" => array(
'label' => $i18n['motion']['fade']['label'],
'description' => $i18n['motion']['fade']['description'],
'startValueTitle' => $i18n['motion']['fade']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['fade']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['fade']['endValueTitle'],
'icon' => 'animation-fade',
'default' => '0|50|50|100|0|100|100',
"{$prefix}scaling" => array(
'label' => $i18n['motion']['scaling']['label'],
'description' => $i18n['motion']['scaling']['description'],
'startValueTitle' => $i18n['motion']['scaling']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['scaling']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['scaling']['endValueTitle'],
'default' => '0|50|50|100|70|100|100',
"{$prefix}rotating" => array(
'label' => $i18n['motion']['rotating']['label'],
'description' => $i18n['motion']['rotating']['description'],
'startValueTitle' => $i18n['motion']['rotating']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['rotating']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['rotating']['endValueTitle'],
'default' => '0|50|50|100|90|0|0',
"{$prefix}blur" => array(
'label' => $i18n['motion']['blur']['label'],
'description' => $i18n['motion']['blur']['description'],
'startValueTitle' => $i18n['motion']['blur']['startValueTitle'],
'middleValueTitle' => $i18n['motion']['blur']['middleValueTitle'],
'endValueTitle' => $i18n['motion']['blur']['endValueTitle'],
'default' => '0|40|60|100|10|0|0',
protected function _add_scroll_effects_fields() {
if ( is_array( self::$_->array_get( $this->advanced_fields, 'scroll_effects', array() ) ) ) {
$this->_additional_fields_options = array_merge(
$this->_additional_fields_options,
ET_Builder_Module_Fields_Factory::get( 'Scroll' )->get_fields(array(
'options' => $this->get_scroll_effects_options(),
'grid_support' => self::$_->array_get( $this->advanced_fields, 'scroll_effects.grid_support', 'no' ),
* Add margin & padding option fields.
* @since 3.23 Add allowed CSS units for margin and padding.
protected function _add_margin_padding_fields() {
// Margin-Padding fields are added by default if module has partial or full VB support
if ( $this->has_vb_support() ) {
$this->advanced_fields['margin_padding'] = self::$_->array_get( $this->advanced_fields, 'margin_padding', array() );
} else if ( ! $this->has_advanced_fields ) {
// Disable if module doesn't set advanced_fields property and has no VB support
// Margin settings have to be array
if ( ! is_array( self::$_->array_get( $this->advanced_fields, 'margin_padding' ) ) ) {
$additional_options = array();
'draggable_margin' => true,
'draggable_padding' => true,
$this->advanced_fields['margin_padding'] = wp_parse_args( $this->advanced_fields['margin_padding'], $defaults );
$tab_slug = isset( $this->advanced_fields['margin_padding']['tab_slug'] ) ? $this->advanced_fields['margin_padding']['tab_slug'] : 'advanced';
$toggle_disabled = isset( $this->advanced_fields['margin_padding']['disable_toggle'] ) && $this->advanced_fields['margin_padding']['disable_toggle'];
$toggle_slug = isset( $this->advanced_fields['margin_padding']['toggle_slug'] ) ? $this->advanced_fields['margin_padding']['toggle_slug'] : 'margin_padding';
if ( ! isset( $i18n['margin'] ) ) {
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
'title' => esc_html__( 'Spacing', 'et_builder' ),
'label' => esc_html__( 'Margin', 'et_builder' ),
'description' => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'et_builder' ),
'label' => esc_html__( 'Padding', 'et_builder' ),
'description' => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'et_builder' ),
if ( ! $toggle_disabled ) {
'title' => $i18n['margin']['toggle']['title'],
$this->_add_settings_modal_toggles( $tab_slug, $margin_toggle );
if ( $this->advanced_fields['margin_padding']['use_margin'] ) {
$additional_options['custom_margin'] = array(
'label' => $i18n['margin']['margin']['label'],
'description' => $i18n['margin']['margin']['description'],
'type' => 'custom_margin',
'mobile_options' => true,
'option_category' => 'layout',
'toggle_slug' => $toggle_slug,
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
$additional_options['custom_margin_tablet'] = array(
$additional_options['custom_margin_phone'] = array(
'toggle_slug' => $toggle_slug,
// make it possible to override/add options
if ( ! empty( $this->advanced_fields['margin_padding']['custom_margin'] ) ) {
$additional_options['custom_margin'] = array_merge( $additional_options['custom_margin'], $this->advanced_fields['margin_padding']['custom_margin'] );
$additional_options["custom_margin_last_edited"] = array(
'toggle_slug' => $toggle_slug,
$additional_options["padding_1_last_edited"] = array(
'toggle_slug' => $toggle_slug,
$additional_options["padding_2_last_edited"] = array(
'toggle_slug' => $toggle_slug,
$additional_options["padding_3_last_edited"] = array(
'toggle_slug' => $toggle_slug,
$additional_options["padding_4_last_edited"] = array(
'toggle_slug' => $toggle_slug,
if ( $this->advanced_fields['margin_padding']['use_padding'] ) {
$additional_options['custom_padding'] = array(
'label' => $i18n['margin']['padding']['label'],
'description' => $i18n['margin']['padding']['description'],
'type' => 'custom_padding',
'mobile_options' => true,
'option_category' => 'layout',
'toggle_slug' => $toggle_slug,
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
$additional_options['custom_padding_tablet'] = array(
'toggle_slug' => $toggle_slug,
$additional_options['custom_padding_phone'] = array(
'toggle_slug' => $toggle_slug,
// make it possible to override/add options
if ( ! empty( $this->advanced_fields['margin_padding']['custom_padding'] ) ) {
$additional_options['custom_padding'] = array_merge( $additional_options['custom_padding'], $this->advanced_fields['margin_padding']['custom_padding'] );
$additional_options["custom_padding_last_edited"] = array(
'toggle_slug' => $toggle_slug,
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
* Add button option fields.
* @since 3.23 Add custom padding for button options set. Add allowed CSS units. Set custom
* default for text size and border width. Add responsive settings for button
* settings. Set custom group label. Add ability hide and show the icon settings.
protected function _add_button_fields() {
// Disable if module doesn't set advanced_fields property and has no VB support
if ( ! $this->has_advanced_fields ) {
// Button settings have to be array
if ( ! is_array( self::$_->array_get( $this->advanced_fields, 'button' ) ) ) {
// Auto-add attributes toggle
$toggles_custom_css_tab = isset( $this->settings_modal_toggles['custom_css'] ) ? $this->settings_modal_toggles['custom_css'] : array();
if ( ! isset( $toggles_custom_css_tab['toggles'] ) || ! isset( $toggles_custom_css_tab['toggles']['attributes'] ) ) {
$this->_add_settings_modal_toggles( 'custom_css', array(
'title' => esc_html__( 'Attributes', 'et_builder' ),
$additional_options = array();
$hover = et_pb_hover_options();
foreach ( $this->advanced_fields['button'] as $option_name => $option_settings ) {
$tab_slug = isset( $option_settings['tab_slug'] ) ? $option_settings['tab_slug'] : 'advanced';
$toggle_disabled = isset( $option_settings['disable_toggle'] ) && $option_settings['disable_toggle'];
if ( ! $toggle_disabled ) {
$toggle_slug = isset( $option_settings['toggle_slug'] ) ? $option_settings['toggle_slug'] : $option_name;
'title' => esc_html( $option_settings['label'] ),
$this->_add_settings_modal_toggles( $tab_slug, $button_toggle );
// Custom default values defined on module.
$text_size_default = self::$_->array_get( $option_settings, 'text_size.default', '' );
$border_width_default = self::$_->array_get( $option_settings, 'border_width.default', '' );
$additional_options["custom_{$option_name}"] = array(
'label' => sprintf( esc_html__( 'Use Custom Styles For %1$s ', 'et_builder' ), $option_settings['label'] ),
'description' => esc_html__( "If you would like to customize the appearance of this module's button, you must first enable custom button styles.", 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'button',
'off' => et_builder_i18n( 'No' ),
'on' => et_builder_i18n( 'Yes' ),
"{$option_name}_text_color",
"{$option_name}_text_size",
"{$option_name}_border_width",
"{$option_name}_border_radius",
"{$option_name}_letter_spacing",
"{$option_name}_spacing",
"{$option_name}_bg_color",
"{$option_name}_border_color",
"{$option_name}_use_icon",
$hover->get_hover_field( "{$option_name}_text_color" ),
$hover->get_hover_field( "{$option_name}_border_color" ),
$hover->get_hover_field( "{$option_name}_border_radius" ),
$hover->get_hover_field( "{$option_name}_letter_spacing" ),
"{$option_name}_text_shadow_style", // Add Text Shadow to button options
"{$option_name}_custom_margin",
"{$option_name}_custom_padding",
'default_on_front' => 'off',
'toggle_slug' => $toggle_slug,
$additional_options["{$option_name}_text_size"] = array(
'label' => sprintf( $i18n['font']['size']['label'], $option_settings['label'] ),
'description' => esc_html__( 'Increase or decrease the size of the button text.', 'et_builder' ),
'range_settings' => array(
'option_category' => 'button',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'default' => ! empty( $text_size_default ) ? $text_size_default : ET_Global_Settings::get_value( 'all_buttons_font_size' ),
'toggle_slug' => $toggle_slug,
'mobile_options' => true,
'depends_show_if' => 'on',
$additional_options["{$option_name}_text_color"] = array(
'label' => sprintf( $i18n['font']['color']['label'], $option_settings['label'] ),
'description' => esc_html__( 'Pick a color to be used for the button text.', 'et_builder' ),
'option_category' => 'button',
'toggle_slug' => $toggle_slug,
'depends_show_if' => 'on',
'mobile_options' => true,
$additional_options["{$option_name}_bg_color"] = array(
'label' => sprintf( esc_html__( '%1$s Background', 'et_builder' ), $option_settings['label'] ),
'description' => esc_html__( 'Adjust the background style of the button by customizing the background color, gradient, and image.', 'et_builder' ),
'type' => 'background-field',
'base_name' => "{$option_name}_bg",
'context' => "{$option_name}_bg_color",
'option_category' => 'button',