: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$existing_text_settings['fields_default_on_child'] = true;
$block_elements_default_settings['fields_default_on_child'] = true;
// a. Paragraph - Convert main text as sub toggle P.
// Convert font settings with block_elements property to be sub toggle of P as
// default. So, we can avoid migration because no settings changed after we added
// block elements. We also need to set default line_height and font_size.
$advanced_font_options[ $option_name ] = array_merge( $existing_text_settings, array(
'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
$link_element_selector = isset( $block_elements_css['link'] ) ? $block_elements_css['link'] : "{$block_elements_selector} a";
$advanced_font_options["{$option_name}_link"] = array_merge( $block_elements_default_settings, array(
'label' => et_builder_i18n( 'Link' ),
'main' => $link_element_selector,
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
$ul_element_selector = et_()->array_get( $block_elements_css, 'ul', "{$block_elements_selector} ul" );
$ul_li_element_selector = et_()->array_get( $block_elements_css, 'ul_li', "{$ul_element_selector} li" );
$ul_item_indent_selector = et_()->array_get( $block_elements_css, 'ul_item_indent', $ul_element_selector );
$advanced_font_options["{$option_name}_ul"] = array_merge( $block_elements_default_settings, array(
'label' => esc_html__( 'Unordered List', 'et_builder' ),
'main' => $ul_li_element_selector,
'item_indent' => $ul_item_indent_selector,
$ol_element_selector = et_()->array_get( $block_elements_css, 'ol', "{$block_elements_selector} ol" );
$ol_li_element_selector = et_()->array_get( $block_elements_css, 'ol_li', "{$ol_element_selector} li" );
$ol_item_indent_selector = et_()->array_get( $block_elements_css, 'ol_item_indent', $ol_element_selector );
$advanced_font_options["{$option_name}_ol"] = array_merge( $block_elements_default_settings, array(
'label' => esc_html__( 'Ordered List', 'et_builder' ),
'main' => $ol_li_element_selector,
'item_indent' => $ol_item_indent_selector,
$quote_element_selector = isset( $block_elements_css['quote'] ) ? $block_elements_css['quote'] : "{$block_elements_selector} blockquote";
$advanced_font_options["{$option_name}_quote"] = array_merge( $block_elements_default_settings, array(
'label' => esc_html__( 'Blockquote', 'et_builder' ),
'main' => $quote_element_selector,
$this->advanced_fields['fonts'] = $advanced_font_options;
foreach ( $advanced_font_options as $option_name => $option_settings ) {
$option_settings = wp_parse_args( $option_settings, array(
'letter_spacing' => array(),
$toggle_disabled = isset( $option_settings['disable_toggle'] ) && $option_settings['disable_toggle'];
$tab_slug = isset( $option_settings['tab_slug'] ) ? $option_settings['tab_slug'] : 'advanced';
if ( ! $toggle_disabled ) {
$toggle_slug = isset( $option_settings['toggle_slug'] ) ? $option_settings['toggle_slug'] : $option_name;
$sub_toggle = isset( $option_settings['sub_toggle'] ) ? $option_settings['sub_toggle'] : '';
if ( ! isset( $option_settings['toggle_slug'] ) ) {
'title' => sprintf( '%1$s %2$s', esc_html( $option_settings['label'] ), et_builder_i18n( 'Text' ) ),
'priority' => 50 + $font_options_count,
$this->_add_settings_modal_toggles( $tab_slug, $font_toggle );
if ( isset( $option_settings['header_level'] ) ) {
$additional_options["{$option_name}_level"] = array(
'label' => sprintf( esc_html__( '%1$s Heading Level', 'et_builder' ), $option_settings['label'] ),
'description' => sprintf( esc_html__( 'Module %1$s are created using HTML headings. You can change the heading level for this module by choosing anything from H1 through H6. Higher heading levels are smaller and less significant.', 'et_builder' ), $option_settings['label'] ),
'type' => 'multiple_buttons',
'option_category' => 'font_option',
'h1' => array( 'title' => 'H1', 'icon' => 'text-h1', ),
'h2' => array( 'title' => 'H2', 'icon' => 'text-h2', ),
'h3' => array( 'title' => 'H3', 'icon' => 'text-h3', ),
'h4' => array( 'title' => 'H4', 'icon' => 'text-h4', ),
'h5' => array( 'title' => 'H5', 'icon' => 'text-h5', ),
'h6' => array( 'title' => 'H6', 'icon' => 'text-h6', ),
'default' => isset( $option_settings['header_level']['default'] ) ? $option_settings['header_level']['default'] : 'h2',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'advanced_fields' => true,
if ( isset( $option_settings['header_level']['computed_affects'] ) ) {
$additional_options["{$option_name}_level"]['computed_affects'] = $option_settings['header_level']['computed_affects'];
if ( ! isset( $option_settings['hide_font'] ) || ! $option_settings['hide_font'] ) {
$additional_options["{$option_name}_font"] = wp_parse_args( $option_settings['font'], array(
'label' => sprintf( $i18n['font']['font']['label'], $option_settings['label'] ),
'description' => sprintf( $i18n['font']['font']['description'], $option_settings['label'] ),
'group_label' => et_core_esc_previously( $option_settings['label'] ),
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'mobile_options' => true,
// add reference to the obsolete "all caps" option if needed
if ( isset( $option_settings['use_all_caps'] ) && $option_settings['use_all_caps'] ) {
$additional_options["{$option_name}_font"]['attributes'] = array( 'data-old-option-ref' => "{$option_name}_all_caps" );
// set the depends_show_if parameter if needed
if ( isset( $option_settings['depends_show_if'] ) ) {
$additional_options["{$option_name}_font"]['depends_show_if'] = $option_settings['depends_show_if'];
// Set default font settings.
if ( ! empty( $option_settings['font']['default'] ) ) {
$additional_options["{$option_name}_font"]['default'] = $option_settings['font']['default'];
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_font"]['default_on_child'] = true;
if ( ! isset( $option_settings['hide_text_align'] ) || ! $option_settings['hide_text_align'] ) {
$additional_options["{$option_name}_text_align"] = wp_parse_args( $option_settings['text_align'], array(
'label' => sprintf( $i18n['font']['text_align']['label'], $option_settings['label'] ),
'description' => sprintf( $i18n['font']['text_align']['description'], $option_settings['label'] ),
'option_category' => 'layout',
'options' => et_builder_get_text_orientation_options( array( 'justified' ), array( 'justify' => 'Justified' ) ),
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'advanced_fields' => true,
'mobile_options' => true,
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_text_align"]['default_on_child'] = true;
if ( ! isset( $option_settings['hide_text_color'] ) || ! $option_settings['hide_text_color'] ) {
$label = et_()->array_get( $option_settings, 'text_color.label', false )
? $option_settings['text_color']['label']
: sprintf( $i18n['font']['color']['label'], $option_settings['label'] );
$additional_options["{$option_name}_text_color"] = array(
'description' => sprintf( $i18n['font']['color']['description'], $option_settings['label'] ),
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'mobile_options' => true,
// add reference to the obsolete color option if needed
if ( self::$_->array_get( $option_settings, 'text_color.old_option_ref' ) ) {
$additional_options["{$option_name}_text_color"]['attributes'] = array( 'data-old-option-ref' => "{$option_settings['text_color']['old_option_ref']}" );
// set default value if defined
if ( self::$_->array_get( $option_settings, 'text_color.default' ) ) {
$additional_options["{$option_name}_text_color"]['default'] = $option_settings['text_color']['default'];
// set the depends_show_if parameter if needed
if ( isset( $option_settings['depends_show_if'] ) ) {
$additional_options["{$option_name}_text_color"]['depends_show_if'] = $option_settings['depends_show_if'];
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_text_color"]['default_on_child'] = true;
if ( ! isset( $option_settings['hide_font_size'] ) || ! $option_settings['hide_font_size'] ) {
$additional_options["{$option_name}_font_size"] = wp_parse_args( $option_settings['font_size'], array(
'label' => sprintf( $i18n['font']['size']['label'], $option_settings['label'] ),
'description' => sprintf( $i18n['font']['size']['description'], $option_settings['label'] ),
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'mobile_options' => true,
'range_settings' => array(
// set the depends_show_if parameter if needed
if ( isset( $option_settings['depends_show_if'] ) ) {
$additional_options["{$option_name}_font_size"]['depends_show_if'] = $option_settings['depends_show_if'];
if ( isset( $option_settings['header_level'] ) ) {
$header_level_default = isset( $option_settings['header_level']['default'] ) ? $option_settings['header_level']['default'] : 'h2';
$additional_options["{$option_name}_font_size"]['default_value_depends'] = "{$option_name}_level";
$additional_options["{$option_name}_font_size"]['default_values_mapping'] = array(
// remove default font-size for default header level to use option default
unset( $additional_options["{$option_name}_font_size"]['default_values_mapping'][ $header_level_default ] );
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_font_size"]['default_on_child'] = true;
if ( ! isset( $option_settings['hide_letter_spacing'] ) || ! $option_settings['hide_letter_spacing'] ) {
$additional_options["{$option_name}_letter_spacing"] = wp_parse_args( $option_settings['letter_spacing'], array(
'label' => sprintf( $i18n['font']['letter_spacing']['label'], $option_settings['label'] ),
'description' => sprintf( $i18n['font']['letter_spacing']['description'], $option_settings['label'] ),
'mobile_options' => true,
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'allowed_units' => array( 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
// set the depends_show_if parameter if needed
if ( isset( $option_settings['depends_show_if'] ) ) {
$additional_options["{$option_name}_letter_spacing"]['depends_show_if'] = $option_settings['depends_show_if'];
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_letter_spacing"]['default_on_child'] = true;
if ( ! isset( $option_settings['hide_line_height'] ) || ! $option_settings['hide_line_height'] ) {
$default_option_line_height = array(
'label' => sprintf( $i18n['font']['line_height']['label'], $option_settings['label'] ),
'description' => sprintf( $i18n['font']['line_height']['description'], $option_settings['label'] ),
'mobile_options' => true,
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
if ( isset( $option_settings['line_height'] ) ) {
$additional_options["{$option_name}_line_height"] = wp_parse_args(
$option_settings['line_height'],
$default_option_line_height
$additional_options["{$option_name}_line_height"] = $default_option_line_height;
// set the depends_show_if parameter if needed
if ( isset( $option_settings['depends_show_if'] ) ) {
$additional_options["{$option_name}_line_height"]['depends_show_if'] = $option_settings['depends_show_if'];
// Set default on child font settings.
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
$additional_options["{$option_name}_line_height"]['default_on_child'] = true;
// Add text-shadow to font options
if ( ! isset( $option_settings['hide_text_shadow'] ) || ! $option_settings['hide_text_shadow'] ) {
$option = $this->text_shadow->get_fields(array(
// Don't use an additional label for 'text' or else we'll end up with 'Text Text Shadow....'
'label' => 'text' === $option_name ? '' : $option_settings['label'],
'prefix' => $option_name,
'option_category' => 'font_option',
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
'mobile_options' => true,
$additional_options = array_merge( $additional_options, $option );
// The below option is obsolete. This code is for backward compatibility
if ( isset( $option_settings['use_all_caps'] ) && $option_settings['use_all_caps'] ) {
$additional_options["{$option_name}_all_caps"] = array(
'toggle_slug' => $toggle_slug,
'sub_toggle' => $sub_toggle,
// Set options priority if it's exist and not empty. Mostly used to push a setting to
// the top of font settings. For example: reorder Text Color to the top of font settings.
if ( isset( $option_settings['options_priority'] ) && is_array( $option_settings['options_priority'] ) ) {
$options_priority = ! empty( $option_settings['options_priority'] ) ? $option_settings['options_priority'] : array();
$temporary_options = array();
foreach( $options_priority as $option_key => $option_priority ) {
// Ensure the target is exist before adding priority.
if ( isset( $additional_options[ $option_key ] ) ) {
$additional_options[ $option_key ]['priority'] = $option_priority;
// Keep it on temporary options and remove it from additional options.
// It's needed because priority doesn't work for font settings with no
// sub toggle. Basically, we will reorder the array element of font
// settings here to make it works.
$temporary_options[ $option_key ] = $additional_options[ $option_key ];
unset( $additional_options[ $option_key ] );
// Merge temporary options with additional options.
$additional_options = array_merge( $temporary_options, $additional_options );
if ( isset( $option_settings['block_elements'] ) && is_array( $option_settings['block_elements'] ) ) {
// Block Elements - 2. Set sub toggles for block elements.
// Add p, a, ul, ol, and quote as sub toggle of current font settings. We also
// need to add tabbed_subtoggles property there.
'icon' => 'numbered-list',
// Tabbed toggle & BB icons support status.
$tabbed_subtoggles = isset( $option_settings['block_elements']['tabbed_subtoggles'] ) ? $option_settings['block_elements']['tabbed_subtoggles'] : false;
$bb_icons_support = isset( $option_settings['block_elements']['bb_icons_support'] ) ? $option_settings['block_elements']['bb_icons_support'] : false;
$this->_add_settings_modal_sub_toggles( $tab_slug, $toggle_slug, $block_elements, $tabbed_subtoggles, $bb_icons_support );
// Block Elements - 3. Set additional options for ul/ol/qoute sub toggles.
// a. UL - Type, Position, and Indent.
$additional_options["{$option_name}_ul_type"] = array(
'label' => esc_html__( 'Unordered List Style Type', 'et_builder' ),
'description' => esc_html__( 'This setting adjusts the shape of the bullet point that begins each list item.', 'et_builder' ),
'option_category' => 'configuration',
'disc' => et_builder_i18n( 'Disc' ),
'circle' => et_builder_i18n( 'Circle' ),
'square' => et_builder_i18n( 'Square' ),
'none' => et_builder_i18n( 'None' ),
'default_on_front' => '',
'tab_slug' => 'advanced',
'toggle_slug' => $option_name,
'mobile_options' => true,
$additional_options["{$option_name}_ul_position"] = array(
'label' => esc_html__( 'Unordered List Style Position', 'et_builder' ),
'description' => esc_html__( 'The bullet point that begins each list item can be placed either inside or outside the parent list wrapper. Placing list items inside will indent them further within the list.', 'et_builder' ),
'option_category' => 'configuration',
'outside' => et_builder_i18n( 'Outside' ),
'inside' => et_builder_i18n( 'Inside' ),
'default_on_front' => '',
'tab_slug' => 'advanced',
'toggle_slug' => $option_name,
'mobile_options' => true,
$additional_options["{$option_name}_ul_item_indent"] = array(
'label' => esc_html__( 'Unordered List Item Indent', 'et_builder' ),
'description' => esc_html__( 'Increasing indentation will push list items further towards the center of the text content, giving the list more visible separation from the the rest of the text.', 'et_builder' ),
'option_category' => 'configuration',
'tab_slug' => 'advanced',
'toggle_slug' => $option_name,
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'default_on_front' => '',
'range_settings' => array(
'mobile_options' => true,
// b. OL - Type, Position, and Indent.
$additional_options["{$option_name}_ol_type"] = array(
'label' => esc_html__( 'Ordered List Style Type', 'et_builder' ),
'description' => esc_html__( 'Here you can choose which types of characters are used to distinguish between each item in the ordered list.', 'et_builder' ),
'option_category' => 'configuration',
'armenian' => 'armenian',
'cjk-ideographic' => 'cjk-ideographic',
'decimal-leading-zero' => 'decimal-leading-zero',
'georgian' => 'georgian',
'hiragana' => 'hiragana',
'hiragana-iroha' => 'hiragana-iroha',
'katakana' => 'katakana',
'katakana-iroha' => 'katakana-iroha',
'lower-alpha' => 'lower-alpha',