: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
static function get_module_icons() {
* Filters Module Icons displayed in Add Module modals.
* @param array $module_icons Array of all registered module icons.
$module_icons = apply_filters( 'et_builder_module_icons', self::$module_icons );
foreach ( $module_icons as $key => $icons ) {
if ( isset( $icons['icon_path'] ) ) {
// Get svg content based on given svg's path
$icon_svg = et_()->WPFS()->exists( $icons['icon_path'] ) ? et_()->WPFS()->get_contents( $icons['icon_path'] ) : false;
$module_icons[ $key ]['icon_svg'] = $icon_svg;
// Remove icon path attribute since it's no longer used
unset( $module_icons[ $key ]['icon_path'] );
* Get combined array of child and parent modules for provided post_type
static function get_parent_and_child_modules( $post_type = '' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );
return array_merge( $parent_modules, $child_modules );
* Get a module instance for provided post type by its slug.
* @param string $post_type
* @return ET_Builder_Element|null
public static function get_module( $slug, $post_type = 'post' ) {
$modules = self::get_parent_and_child_modules( $post_type );
return self::$_->array_get( $modules, $slug );
* Outputs list of all module help videos array
static function get_help_videos() {
return self::$module_help_videos;
static function get_featured_image_background_modules( $post_type = '' ) {
$parent_modules = self::get_parent_modules( $post_type );
$featured_image_background_modules = array();
foreach ( $parent_modules as $slug => $parent_module ) {
if ( ! empty( $parent_module->featured_image_background ) ) {
$featured_image_background_modules[] = $slug;
* Filters list of modules with support of featured image as background.
* @param array[] $featured_image_background_modules List of modules with support of featured image as background.
return apply_filters( 'et_pb_featured_image_background_modules', $featured_image_background_modules );
public static function get_toggles( $post_type ) {
static $toggles_array = array();
$modules = self::get_parent_and_child_modules( $post_type );
$custom_modules = array();
foreach ( $modules as $module_slug => $module ) {
if ( ! $module->_is_official_module ) {
$custom_modules[ $module_slug ] = $module;
foreach ( $module->settings_modal_toggles as $tab_slug => &$tab_data ) {
if ( ! isset( $tab_data['toggles'] ) ) {
$tab_data['toggles'] = self::et_pb_order_toggles_by_priority( $tab_data['toggles'] );
$toggles_array[ $module_slug ] = $module->settings_modal_toggles;
// Add missing toggle definitions for any existing toggles used in custom modules
foreach ( $custom_modules as $module_slug => $module ) {
foreach ( $module->get_complete_fields() as $field_name => $field_info ) {
$tab_slug = self::$_->array_get( $field_info, 'tab_slug' );
$tab_slug = empty( $tab_slug ) ? 'general' : $tab_slug;
$toggle_slug = self::$_->array_get( $field_info, 'toggle_slug' );
if ( ! $toggle_slug || isset( $toggles_array[ $module_slug ][ $tab_slug ]['toggles'][ $toggle_slug ] ) ) {
// Find existing definition
foreach ( $toggles_array as $_module_slug => $tabs ) {
foreach ( $tabs as $tab => $toggles ) {
if ( isset( $toggles['toggles'][ $toggle_slug ] ) ) {
"{$module_slug}.{$tab_slug}.toggles.{$toggle_slug}",
$toggles['toggles'][ $toggle_slug ]
$toggles_array[ $module_slug ][ $tab_slug ]['toggles'] = self::et_pb_order_toggles_by_priority( $toggles_array[ $module_slug ][ $tab_slug ]['toggles'] );
// Add missing unregistered toggles to the list
if ( ! isset( $toggles_array[ $module_slug ][ $tab_slug ]['toggles'][ $toggle_slug ] ) ) {
if ( ! isset( $toggles_array[ $module_slug ][ $tab_slug ] ) ) {
$toggles_array[ $module_slug ][ $tab_slug ] = array( 'toggles' => array( $toggle_slug ) );
$toggles_array[ $module_slug ][ $tab_slug ]['toggles'][] = $toggle_slug;
public static function get_tabs( $post_type = '' ) {
$official_tabs = array( 'general' => '', 'advanced' => '', 'custom_css' => '' );
$modules = self::get_parent_and_child_modules( $post_type );
foreach( $modules as $module_slug => $module ) {
if ( '' === $post_type ) {
foreach( $module as $_module_slug => $_module ) {
// Backward compatibility with custom tabs registered via `et_builder_main_tabs` filter.
$bb_custom_tabs = array_diff_key( $_module->get_main_tabs(), $official_tabs );
$bb_custom_tabs_formatted = array();
// Prepare properly formatted array of tabs data
foreach ( $bb_custom_tabs as $tab_id => $tab_name ) {
$bb_custom_tabs_formatted[ $tab_id ] = array( 'name' => $tab_name );
// Add BB custom tabs to all modules
$tabs_array[ $_module_slug ] = $bb_custom_tabs_formatted;
if ( ! isset( $_module->settings_modal_tabs ) ) {
$tabs_array[ $_module_slug ] = array_merge( $tabs_array[ $_module_slug ], $_module->settings_modal_tabs );
// Backward compatibility with custom tabs registered via `et_builder_main_tabs` filter.
$bb_custom_tabs = array_diff_key( $module->get_main_tabs(), $official_tabs );
$bb_custom_tabs_formatted = array();
// Prepare properly formatted array of tabs data
foreach ( $bb_custom_tabs as $tab_id => $tab_name ) {
$bb_custom_tabs_formatted[ $tab_id ] = array( 'name' => $tab_name );
// Add BB custom tabs to all modules
$tabs_array[ $module_slug ] = $bb_custom_tabs_formatted;
if ( ! isset( $module->settings_modal_tabs ) ) {
$tabs_array[ $module_slug ] = array_merge( $tabs_array[ $module_slug ], $module->settings_modal_tabs );
static function get_options_categories() {
$options_categories = array(
'name' => esc_html__( 'Edit Colors', 'et_builder' ),
'name' => esc_html__( 'Edit Content', 'et_builder' ),
'name' => esc_html__( 'Edit Fonts', 'et_builder' ),
'name' => esc_html__( 'Edit Buttons', 'et_builder' ),
'name' => esc_html__( 'Edit Layout', 'et_builder' ),
'name' => esc_html__( 'Edit Borders', 'et_builder' ),
'edit_configuration' => array(
'name' => esc_html__( 'Edit Configuration', 'et_builder' ),
$options_categories = array_merge( $options_categories, self::get_custom_options_categories() );
return $options_categories;
static function get_custom_options_categories( $post_type = '' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );
$custom_options_categories = array();
$_modules = array_merge_recursive( $parent_modules, $child_modules );
foreach( $_modules as $_module_slug => $_module ) {
if ( '' === $post_type ) {
foreach( $_module as $__module_slug => $__module ) {
if ( ! isset( $__module->options_categories ) ) {
$custom_options_categories = array_merge( $custom_options_categories, $__module->options_categories );
if ( ! isset( $_module->options_categories ) ) {
$custom_options_categories = array_merge( $custom_options_categories, $_module->options_categories );
return $custom_options_categories;
static function get_all_fields( $post_type = '' ) {
$_modules = self::get_parent_and_child_modules( $post_type );
$module_fields = array();
foreach( $_modules as $_module_slug => $_module ) {
// skip modules without fb support
if ( ! isset( $_module->vb_support ) || 'off' === $_module->vb_support ) {
$_module->_add_additional_fields();
$_module->_add_custom_css_fields();
$_module->_maybe_add_defaults();
$_module->_finalize_all_fields();
foreach ( $_module->fields_unprocessed as $field_key => $field ) {
// do not add the fields with 'skip' type. These fields used for rendering shortcode on Front End only
if ( isset( $field['type'] ) && 'skip' === $field['type'] ) {
$field['name'] = $field_key;
$module_fields[ $_module_slug ][ $field_key ] = $field;
static function get_general_fields( $post_type = '', $mode = 'all', $module_type = 'all' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );
$_modules = $parent_modules;
$_modules = $child_modules;
$_modules = array_merge( $parent_modules, $child_modules );
$module_fields = array();
foreach( $_modules as $_module_slug => $_module ) {
// filter modules by slug if needed
if ( 'all' !== $module_type && $module_type !== $_module_slug ) {
foreach ( $_module->fields_unprocessed as $field_key => $field ) {
$is_option_template = self::$option_template->is_option_template_field( $field_key );
// Do not process field template
if ( ! $is_option_template && ( isset( $field['tab_slug'] ) && 'general' !== $field['tab_slug'] ) ) {
// Skip if current option template isn't eligible for `advanced` tab
if ( $is_option_template && ! self::$option_template->is_template_inside_tab( 'general', $field ) ) {
$module_fields[ $_module_slug ][ $field_key ] = $field;
// Some module types must be separated for the Global Presets.
// For example we keep all section types as `et_pb_section` however they need different Global Presets.
$additional_slugs = self::$global_presets_manager->get_module_additional_slugs( $_module_slug );
foreach ( $additional_slugs as $alias ) {
$module_fields[ $alias ] = $module_fields[ $_module_slug ];
if ( 'all' !== $module_type ) {
return $module_fields[ $module_type ];
static function get_settings_modal_tabs_fields( $post_type = '', $mode = 'all', $module_type = 'all' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );
$_modules = $parent_modules;
$_modules = $child_modules;
$_modules = array_merge( $parent_modules, $child_modules );
$module_fields = array();
foreach( $_modules as $_module_slug => $_module ) {
// filter modules by slug if needed
if ( 'all' !== $module_type && $module_type !== $_module_slug ) {
foreach ( $_module->fields_unprocessed as $field_key => $field ) {
$this_tab_slug = isset( $field['tab_slug'] ) ? $field['tab_slug'] : false;
if ( ! $this_tab_slug || in_array( $this_tab_slug, array( 'general', 'advanced', 'custom_css' ) ) ) {
$field['name'] = $field_key;
$module_fields[ $_module_slug ][ $this_tab_slug ][ $field_key ] = $field;
if ( 'all' !== $module_type ) {
return $module_fields[ $module_type ];
static function get_child_module_titles( $post_type ) {
$child_modules = self::get_child_modules( $post_type );
$child_modules_titles = array();
$child_modules_titles_fields = array( 'advanced_setting_title_text', 'child_title_fallback_var', 'child_title_var' );
foreach( $child_modules as $_module_slug => $_module ) {
foreach( $child_modules_titles_fields as $single_field ) {
if ( isset( $_module->$single_field ) ) {
$child_modules_titles[ $_module_slug ][ $single_field ] = $_module->$single_field ;
return $child_modules_titles;
static function get_advanced_fields( $post_type = '', $mode = 'all', $module_type = 'all' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );
$_modules = $parent_modules;
$_modules = $child_modules;
$_modules = array_merge( $parent_modules, $child_modules );
$module_fields = array();
foreach( $_modules as $_module_slug => $_module ) {
// filter modules by slug if needed
if ( 'all' !== $module_type && $module_type !== $_module_slug ) {
foreach ( $_module->fields_unprocessed as $field_key => $field ) {
$is_option_template = self::$option_template->is_option_template_field( $field_key );
// Do not process field template
if ( ! $is_option_template && ( ! isset( $field['tab_slug'] ) || 'advanced' !== $field['tab_slug'] ) ) {
// Skip if current option template isn't eligible for `advanced` tab
if ( $is_option_template && ! self::$option_template->is_template_inside_tab( 'advanced', $field ) ) {
if ( isset( $field['default'] ) ) {
$module_fields[ $_module_slug ]['advanced_defaults'][ $field_key ] = $field['default'];
$module_fields[ $_module_slug ][ $field_key ] = $field;
if ( ! empty( $_module->advanced_fields ) ) {
$module_fields[ $_module_slug ]['advanced_common'] = $_module->advanced_fields;
if ( isset( $_module->advanced_fields['border']['border_styles'] ) ) {
$module_fields[ $_module_slug ]['border_styles'] = array_merge( $module_fields[ $_module_slug ]['border_styles'], $_module->advanced_fields['border']['border_styles'] );
if ( isset( $_module->advanced_fields['border']['border_radii'] ) ) {
$module_fileds[ $_module_slug ]['border_radii'] = array_merge( $module_fields[ $_module_slug ]['border_radii'], $_module->advanced_fields['border']['border_radii'] );
// Some module types must be separated for the Global Presets.
// For example we keep all section types as `et_pb_section` however they need different Global Presets.
$additional_slugs = self::$global_presets_manager->get_module_additional_slugs( $_module_slug );
foreach ( $additional_slugs as $alias ) {
$module_fields[ $alias ] = $module_fields[ $_module_slug ];
if ( 'all' !== $module_type ) {
return $module_fields[ $module_type ];
static function get_custom_css_fields( $post_type = '', $mode = 'all', $module_type = 'all' ) {
$parent_modules = self::get_parent_modules( $post_type );
$child_modules = self::get_child_modules( $post_type );