args = $args; add_filter( 'fusionredux/_url', [ $this, 'redux_url_change' ] ); add_filter( 'fusionredux/_dir', [ $this, 'redux_dir_change' ] ); /** * Initialization of the framework needs to be hooked, due to globals not being set earlier etc. * Priority 2 loads he options framework directly after widgets are initialized. */ add_action( 'init', [ $this, 'init_fusionredux' ], 2 ); add_action( 'admin_notices', [ $this, 'admin_notice' ] ); add_action( 'wp_ajax_fusionredux_hide_remote_media_admin_notification', [ $this, 'hide_remote_media_admin_notification' ] ); if ( ! defined( 'FUSION_AJAX_SAVE' ) ) { define( 'FUSION_AJAX_SAVE', true ); } // Backwards-compatibility tweak. add_action( 'fusionredux/options/fusion_options/saved', [ $this, 'bc_action_on_save' ], 10, 2 ); add_action( 'wp_ajax_fusion_reset_all_caches', [ $this, 'reset_caches_handler' ] ); } /** * Change the URL to redux. * * @access public * @since 2.0 * @param string $url The URL to redux. * @return string The new URL to redux. */ public function redux_url_change( $url ) { return FUSION_LIBRARY_URL . '/inc/redux/framework/FusionReduxCore/'; } /** * Change the path to redux. * * @access public * @since 2.0 * @param string $dir The path to redux. * @return string The new path to redux. */ public function redux_dir_change( $dir ) { return FUSION_LIBRARY_PATH . '/inc/redux/framework/FusionReduxCore/'; } /** * Extra functionality on save. * * @access public * @since 1.0 * @param array $data The data. * @param array $changed_values The changed values to save. * @return void */ public function bc_action_on_save( $data, $changed_values ) { do_action( 'fusion_options_save', $data, $changed_values ); } /** * Initializes and triggers all other actions/hooks. * * @access public * @since 1.0 * @return void */ public function init_fusionredux() { $this->fusion_sections = $this->args['sections']; // Add a filter to allow modifying the array. $this->fusion_sections = apply_filters( 'fusion_admin_options_injection', $this->fusion_sections ); self::$is_language_all = $this->args['is_language_all']; add_action( 'update_option_' . $this->args['option_name'], [ $this, 'option_name_settings_update' ], 10, 3 ); $this->key = $this->args['option_name']; if ( ! class_exists( 'FusionRedux' ) ) { require_once wp_normalize_path( dirname( __FILE__ ) . '/redux/framework/fusionredux-framework.php' ); } require_once wp_normalize_path( dirname( __FILE__ ) . '/redux/validation-functions.php' ); if ( ! class_exists( 'Fusion_Redux_Custom_Fields' ) ) { require_once wp_normalize_path( dirname( __FILE__ ) . '/redux/class-fusion-redux-addons.php' ); new Fusion_Redux_Addons( $this->args['option_name'] ); } $version = $this->args['version']; $version_array = explode( '.', $version ); if ( isset( $version_array[2] ) && '0' === $version_array[2] ) { $version = $version_array[0] . '.' . $version_array[1]; } $this->ver = $version; $this->add_config(); $this->parse(); add_action( 'fusionredux/page/' . $this->args['option_name'] . '/enqueue', [ $this, 'enqueue' ] ); add_action( 'admin_head', [ $this, 'dynamic_css' ] ); add_action( 'admin_init', [ $this, 'remove_fusionredux_notices' ] ); add_action( 'admin_notices', [ $this, 'remove_fusionredux_notices' ], 999 ); // Update option for fusion builder and code block encoding. add_action( 'fusionredux/options/' . $this->args['option_name'] . '/saved', [ $this, 'save_as_option' ], 10, 2 ); // Reset caches when loading fusionredux. This is a hack for the preset options. add_action( 'fusion_fusionredux_header', [ $this, 'reset_cache' ] ); // Make sure caches are reset when saving/resetting options. add_action( 'fusionredux/options/' . $this->args['option_name'] . '/reset', [ $this, 'reset_cache' ] ); add_action( 'fusionredux/options/' . $this->args['option_name'] . '/section/reset', [ $this, 'reset_cache' ] ); add_action( 'fusionredux/options/' . $this->args['option_name'] . '/saved', [ $this, 'reset_cache' ] ); // Save all languages. add_action( 'fusionredux/options/' . $this->args['option_name'] . '/reset', [ $this, 'save_all_languages' ] ); add_action( 'fusionredux/options/' . $this->args['option_name'] . '/section/reset', [ $this, 'save_all_languages' ] ); add_action( 'fusionredux/options/' . $this->args['option_name'] . '/saved', [ $this, 'save_all_languages' ] ); add_filter( 'fusionredux/' . $this->args['option_name'] . '/localize', [ $this, 'localize_data' ] ); add_filter( 'fusionredux/' . $this->args['option_name'] . '/localize/reset', [ $this, 'reset_message_l10n' ] ); add_filter( 'fusionredux/' . $this->args['option_name'] . '/localize/reset_section', [ $this, 'reset_section_message_l10n' ] ); add_filter( 'fusionredux-import-file-description', [ $this, 'fusionredux_import_file_description_l10n' ] ); add_filter( 'fusionredux/options/' . $this->args['option_name'] . '/ajax_save/response', [ $this, 'merge_options' ] ); // Get all post types with Avada default ones. add_filter( 'fusionredux/options/' . $this->args['option_name'] . '/data/post_types', [ $this, 'get_post_types' ], 999 ); } /** * Triggers the cache reset. * Add functionality in child classes. * * @access public * @since 1.0 * @return void */ public function reset_cache() { $fusion_cache = new Fusion_Cache(); $fusion_cache->reset_all_caches(); } /** * Get all post type including Avada. * * @param array $data The post types array. * @access public * @since 1.0 * @return array */ public function get_post_types( $data ) { $avada_post_types = [ 'post' => esc_html__( 'Posts', 'Avada' ), 'page' => esc_html__( 'Pages', 'Avada' ), 'avada_portfolio' => esc_html__( 'Portfolio Items', 'Avada' ), 'avada_faq' => esc_html__( 'FAQ Items', 'Avada' ), 'product' => esc_html__( 'WooCommerce Products', 'Avada' ), 'tribe_events' => esc_html__( 'Events Calendar Posts', 'Avada' ), ]; $args = [ 'public' => true, 'show_ui' => true, 'exclude_from_search' => false, ]; $post_types = get_post_types( $args, 'objects', 'and' ); foreach ( $post_types as $post_type ) { if ( isset( $avada_post_types[ $post_type->name ] ) ) { continue; } $avada_post_types[ $post_type->name ] = $post_type->label; } // Remove media. unset( $avada_post_types['attachment'] ); return apply_filters( 'avada_search_results_post_types', $avada_post_types ); } /** * Removes fusionredux admin notices & nag messages * as well as the fusionredux demo mode. * * @access public * @since 1.0 * return void */ public function remove_fusionredux_notices() { if ( class_exists( 'FusionReduxFrameworkPlugin' ) ) { remove_filter( 'plugin_row_meta', [ FusionReduxFrameworkPlugin::get_instance(), 'plugin_metalinks' ], null, 2 ); remove_action( 'admin_notices', [ FusionReduxFrameworkPlugin::get_instance(), 'admin_notices' ] ); remove_action( 'admin_notices', [ FusionReduxFrameworkInstances::get_instance( $this->args['option_name'] ), '_admin_notices' ], 99 ); // Remove the admin metabox. remove_meta_box( 'fusionredux_dashboard_widget', 'dashboard', 'side' ); } } /** * The main parser * * @access public * @since 1.0 * @return void */ public function parse() { // Start looping through the sections from the $fusion_sections object. foreach ( $this->fusion_sections->sections as $section ) { // Create the section. $this->create_section( $section ); // Start looping through the section's fields. // Make sure we have fields defined before proceeding. if ( isset( $section['fields'] ) ) { foreach ( $section['fields'] as $field ) { if ( isset( $field['type'] ) ) { if ( 'sub-section' === $field['type'] ) { if ( ! isset( $field['id'] ) ) { continue; } // This is a subsection so first we need to add the section. $this->create_subsection( $field ); // Make sure we have fields defined before proceeding. // We'll need to add these fields to the subsection. if ( isset( $field['fields'] ) && is_array( $field['fields'] ) ) { foreach ( $field['fields'] as $subfield ) { if ( ! isset( $subfield['id'] ) ) { continue; } // Handle accordions in subsections. if ( isset( $subfield['type'] ) && 'accordion' === $subfield['type'] ) { // Make sure we have fields defined before proceeding. // We'll need to add these fields to the subsection. if ( isset( $subfield['fields'] ) && is_array( $subfield['fields'] ) ) { // Open the accordion. $accordion_start = $subfield; $accordion_start['position'] = 'start'; $accordion_start['id'] = $subfield['id'] . '_start_accordion'; $this->create_field( $accordion_start, $field['id'] ); // Add the fields inside the accordion. foreach ( $subfield['fields'] as $sub_subfield ) { $this->create_field( $sub_subfield, $field['id'] ); } // Close the accordion. $accordion_end = $subfield; $accordion_end['position'] = 'end'; $accordion_end['id'] = $subfield['id'] . '_end_accordion'; $this->create_field( $accordion_end, $field['id'] ); } } else { $this->create_field( $subfield, $field['id'] ); } } } } elseif ( 'accordion' === $field['type'] ) { // Make sure we have fields defined before proceeding. // We'll need to add these fields to the subsection. if ( isset( $field['fields'] ) && is_array( $field['fields'] ) ) { // Open the accordion. $accordion_start = $field; $accordion_start['position'] = 'start'; $accordion_start['id'] = $field['id'] . '_start_accordion'; $this->create_field( $accordion_start, $section['id'] ); // Add the fields inside the accordion. foreach ( $field['fields'] as $subfield ) { $this->create_field( $subfield, $section['id'] ); } // Close the accordion. $accordion_end = $field; $accordion_end['position'] = 'end'; $accordion_end['id'] = $field['id'] . '_end_accordion'; $this->create_field( $accordion_end, $section['id'] ); } } else { $this->create_field( $field, $section['id'] ); } } } } } } /** * Create a section. * * @access public * @param array $section The section arguments. * @since 1.0 * @return void */ public function create_section( $section ) { if ( ! isset( $section['id'] ) ) { return; } if ( ! class_exists( 'FusionRedux' ) ) { return; } // Ability to hide sections via a filter. if ( 'fusion_options' === $this->args['option_name'] && 1 == apply_filters( 'fusion_builder_hide_theme_section', $section['id'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons return; } FusionRedux::setSection( $this->key, [ 'title' => ( isset( $section['label'] ) ) ? $section['label'] : '', 'id' => $section['id'], 'desc' => ( isset( $section['description'] ) ) ? $section['description'] : '', 'highlight' => ( isset( $section['highlight'] ) ) ? $section['highlight'] : '', 'icon' => ( isset( $section['icon'] ) ) ? $section['icon'] : 'el el-home', 'class' => ( isset( $section['class'] ) ) ? $section['class'] : '', ] ); } /** * Creates a subsection. * * @access public * @param array $subsection The subsection arguments. * @since 1.0 * @return void */ public function create_subsection( $subsection ) { $args = [ 'title' => ( isset( $subsection['label'] ) ) ? $subsection['label'] : '', 'id' => $subsection['id'], 'subsection' => true, 'desc' => ( isset( $subsection['description'] ) ) ? $subsection['description'] : '', 'highlight' => ( isset( $subsection['highlight'] ) ) ? $subsection['highlight'] : '', 'class' => ( isset( $subsection['class'] ) ) ? $subsection['class'] : '', 'hidden' => ( isset( $subsection['hidden'] ) ) ? $subsection['hidden'] : false, ]; // Ability to hide sub sections via a filter. if ( 'fusion_options' === $this->args['option_name'] && 1 == apply_filters( 'fusion_builder_hide_theme_sub_section', $subsection['id'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison return; } if ( class_exists( 'FusionRedux' ) ) { FusionRedux::setSection( $this->key, $args ); } } /** * Gets a field. * * @access public * @since 2.0 * @param array $field The field arguments. * @param null|string $section_id The ID of the section. * @return array|null Returns null if there was an error when getting the field, otherwise an array. */ public function get_field( $field, $section_id = null ) { $args = [ 'section_id' => $section_id, 'title' => ( isset( $field['label'] ) ) ? $field['label'] : '', 'subtitle' => ( isset( $field['description'] ) ) ? $field['description'] : '', 'description' => ( isset( $field['help'] ) ) ? $field['help'] : '', 'class' => ( isset( $field['class'] ) ) ? $field['class'] . ' fusion_options' : 'fusion_options', 'options' => ( isset( $field['choices'] ) ) ? $field['choices'] : [], 'required' => [], 'output' => [], ]; if ( isset( $field['hidden'] ) && $field['hidden'] ) { $args['class'] .= ' hidden'; } if ( isset( $field['required'] ) && is_array( $field['required'] ) && ! empty( $field['required'] ) ) { foreach ( $field['required'] as $requirement ) { $requirement['operator'] = ( '==' === $requirement['operator'] ) ? '=' : $requirement['operator']; $args['required'][] = [ $requirement['setting'], $requirement['operator'], $requirement['value'], ]; } } elseif ( isset( $args['required'] ) ) { unset( $args['required'] ); } // This will allow us to have an 'options_mode' setting. // We can have 'simple', 'advanced' etc there, and options will be shown depending on our selection. if ( isset( $field['option_mode'] ) ) { if ( ! isset( $args['required'] ) ) { $args['required'] = []; } $args['required'][] = [ 'options_mode', '=', $field['option_mode'] ]; } if ( ! isset( $field['type'] ) ) { return; } // Ability to hide options via a filter. if ( 'fusion_options' === $this->args['option_name'] && 1 == apply_filters( 'fusion_builder_hide_theme_option', $field['id'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons return; } $font_size_dimension_fields = apply_filters( 'fusion_options_font_size_dimension_fields', [] ); switch ( $field['type'] ) { case 'color': if ( ! isset( $field['transparent'] ) ) { $args['transparent'] = false; } $args['validate_callback'] = 'fusion_fusionredux_validate_color_hex'; break; case 'code': $args['type'] = 'ace_editor'; $args['mode'] = ( isset( $args['options'] ) && isset( $args['options']['language'] ) ) ? $args['options']['language'] : 'css'; $args['theme'] = ( isset( $args['choices'] ) && isset( $args['choices']['theme'] ) ) ? $args['choices']['theme'] : 'chrome'; $args['options']['minLines'] = ( ! isset( $args['options']['minLines'] ) ) ? 18 : $args['options']['minLines']; $args['options']['maxLines'] = ( ! isset( $args['options']['maxLines'] ) ) ? 30 : $args['options']['maxLines']; if ( 'custom_css' === $field['id'] ) { $args['full_width'] = true; } break; case 'radio-buttonset': $args['type'] = 'button_set'; break; case 'dimension': $args['type'] = 'text'; $args['class'] .= ' dimension'; $args['options'] = ''; $args['validate_callback'] = 'fusion_fusionredux_validate_dimension'; if ( in_array( $field['id'], $font_size_dimension_fields, true ) ) { $args['validate_callback'] = 'fusion_fusionredux_validate_font_size'; /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter value including CSS unit (px, em, rem), ex: %2$s.', 'Avada' ), $args['subtitle'], $field['default'] ); } elseif ( 'text_column_spacing' === $field['id'] ) { /* translators: The description subtitle, percetange sign and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter value including any valid CSS unit besides %2$s which does not work for inline columns, ex: %3$s.', 'Avada' ), $args['subtitle'], '%', $field['default'] ); } elseif ( 'page_title_height' === $field['id'] || 'page_title_mobile_height' === $field['id'] ) { /* translators: The description subtitle, percentage sign and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter value including any valid CSS unit besides %2$s which does not work for page title bar, ex: %3$s.', 'Avada' ), $args['subtitle'], '%', $field['default'] ); } else { /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter value including any valid CSS unit, ex: %2$s.', 'Avada' ), $args['subtitle'], $field['default'] ); } break; case 'dimensions': if ( 'lightbox_video_dimensions' === $field['id'] || 'menu_arrow_size' === $field['id'] ) { /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s In pixels, ex: %2$s.', 'Avada' ), $args['subtitle'], implode( ', ', $field['default'] ) ); } else { /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter values including any valid CSS unit, ex: %2$s.', 'Avada' ), $args['subtitle'], implode( ', ', $field['default'] ) ); } $args['validate_callback'] = 'fusion_fusionredux_validate_dimensions'; break; case 'spacing': $args['top'] = ( isset( $field['choices'] ) && isset( $field['choices']['top'] ) ); $args['bottom'] = ( isset( $field['choices'] ) && isset( $field['choices']['bottom'] ) ); $args['left'] = ( isset( $field['choices'] ) && isset( $field['choices']['left'] ) ); $args['right'] = ( isset( $field['choices'] ) && isset( $field['choices']['right'] ) ); $args['validate_callback'] = 'fusion_fusionredux_validate_dimensions'; $default = is_array( $field['default'] ) ? implode( ', ', $field['default'] ) : $field['default']; if ( is_array( $field['default'] ) && empty( array_filter( $field['default'] ) ) ) { $default = '10px, 1em'; } /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter values including any valid CSS unit, ex: %2$s.', 'Avada' ), $args['subtitle'], $default ); break; case 'border_radius': $args['top_left'] = ( isset( $field['choices'] ) && isset( $field['choices']['top_left'] ) ); $args['top_right'] = ( isset( $field['choices'] ) && isset( $field['choices']['top_right'] ) ); $args['bottom_right'] = ( isset( $field['choices'] ) && isset( $field['choices']['bottom_right'] ) ); $args['bottom_left'] = ( isset( $field['choices'] ) && isset( $field['choices']['bottom_left'] ) ); $args['validate_callback'] = 'fusion_fusionredux_validate_dimensions'; $default = is_array( $field['default'] ) ? implode( ', ', $field['default'] ) : $field['default']; /* translators: The description subtitle and an example value. */ $args['subtitle'] = sprintf( esc_html__( '%1$s Enter values including any valid CSS unit, ex: %2$s.', 'Avada' ), $args['subtitle'], $default ); break; case 'number': $args['type'] = 'spinner'; if ( isset( $field['choices'] ) && isset( $field['choices']['min'] ) ) { $args['min'] = $field['choices']['min']; } if ( isset( $field['choices'] ) && isset( $field['choices']['max'] ) ) { $args['max'] = $field['choices']['max']; } if ( isset( $field['choices'] ) && isset( $field['choices']['step'] ) ) { $args['step'] = $field['choices']['step']; } break; case 'select': $args['width'] = 'width:100%;'; $args['select3'] = [ 'minimumResultsForSearch' => '-1', 'allowClear' => false, ]; $args['validate_callback'] = 'fusion_fusionredux_validate_select'; break; case 'slider': $not_in_pixels = apply_filters( 'fusion_options_sliders_not_in_pixels', [] ); if ( ! in_array( $field['id'], $not_in_pixels, true ) ) { $args['subtitle'] = $args['subtitle'] . ' ' . esc_html__( 'In pixels.', 'Avada' ); } if ( isset( $field['choices'] ) && isset( $field['choices']['min'] ) ) { $args['min'] = $field['choices']['min']; } if ( isset( $field['choices'] ) && isset( $field['choices']['max'] ) ) { $args['max'] = $field['choices']['max']; } if ( isset( $field['choices'] ) && isset( $field['choices']['step'] ) ) { $args['step'] = $field['choices']['step']; } if ( isset( $field['choices']['step'] ) && 1 > $field['choices']['step'] ) { $args['resolution'] = 0.1; if ( .1 > $field['choices']['step'] ) { $args['resolution'] = 0.01; } elseif ( .01 > $field['choices']['step'] ) { $args['resolution'] = 0.001; } } break; case 'switch': case 'toggle': $args['type'] = 'switch'; if ( isset( $field['choices'] ) && isset( $field['choices']['on'] ) ) { $args['on'] = $field['choices']['on']; } if ( isset( $field['choices'] ) && isset( $field['choices']['off'] ) ) { $args['off'] = $field['choices']['off']; } break; case 'color-alpha': $args['type'] = 'color_alpha'; $args['transparent'] = false; $args['validate_callback'] = 'fusion_fusionredux_validate_color_rgba'; break; case 'color-palette': $args['type'] = 'color_palette'; break; case 'typography-sets': $args['type'] = 'typography_sets'; break; case 'preset': case 'preset': $args['type'] = 'image_select'; $args['presets'] = true; $args['options'] = []; foreach ( $field['choices'] as $choice => $choice_args ) { if ( is_array( $choice_args ) ) { $args['options'][ $choice ] = [ 'alt' => $choice_args['label'], 'img' => $choice_args['image'], 'presets' => $choice_args['settings'], ]; } } break; case 'radio-image': $args['type'] = 'image_select'; $args['options'] = []; foreach ( $field['choices'] as $id => $url ) { $args['options'][ $id ] = [ 'alt' => $id, 'img' => $url, ]; } if ( 'header_layout' === $field['id'] ) { $args['full_width'] = true; } break; case 'upload': case 'media': $args['type'] = 'media'; if ( isset( $field['default'] ) && ! is_array( $field['default'] ) ) { $args['default'] = empty( $field['default'] ) ? [] : $args['default'] = [ 'url' => $field['default'] ]; } $this->media_fields[ $field['id'] ] = $field; break; case 'radio': $args['options'] = []; foreach ( $field['choices'] as $choice => $label ) { if ( is_array( $label ) ) { $args['options'][ $choice ] = '' . $label[0] . '
' . $label[1] . '
'; } else { $args['options'][ $choice ] = $label; } } break; case 'multicheck': $args['type'] = 'checkbox'; break; case 'typography': $args['default'] = []; if ( isset( $field['default'] ) ) { if ( isset( $field['default']['font-weight'] ) ) { $args['default']['font-weight'] = $field['default']['font-weight']; } if ( isset( $field['default']['font-size'] ) ) { $args['default']['font-size'] = $field['default']['font-size']; } if ( isset( $field['default']['font-family'] ) ) { $args['default']['font-family'] = $field['default']['font-family']; $args['default']['font-backup'] = true; $args['default']['google'] = true; } if ( isset( $field['default']['line-height'] ) ) { $args['default']['line-height'] = $field['default']['line-height']; } if ( isset( $field['default']['word-spacing'] ) ) { $args['default']['word-spacing'] = $field['default']['word-spacing']; } if ( isset( $field['default']['letter-spacing'] ) ) { $args['default']['letter-spacing'] = $field['default']['letter-spacing']; } if ( isset( $field['default']['color'] ) ) { $args['default']['color'] = $field['default']['color']; } if ( isset( $field['default']['text-align'] ) ) { $args['default']['text-align'] = $field['default']['text-align']; } if ( isset( $field['default']['text-transform'] ) ) { $args['default']['text-transform'] = $field['default']['text-transform']; } if ( isset( $field['default']['margin-top'] ) ) { $args['default']['margin-top'] = $field['default']['margin-top']; } if ( isset( $field['default']['margin-bottom'] ) ) { $args['default']['margin-bottom'] = $field['default']['margin-bottom']; } } $args['fonts'] = Fusion_Data::standard_fonts(); $args['font-backup'] = true; $args['font-style'] = ( isset( $args['default']['font-style'] ) || ( isset( $field['choices']['font-style'] ) && $field['choices']['font-style'] ) ) ? true : false; $args['font-weight'] = ( isset( $args['default']['font-weight'] ) || ( isset( $field['choices']['font-weight'] ) && $field['choices']['font-weight'] ) ) ? true : false; $args['font-size'] = ( isset( $args['default']['font-size'] ) || ( isset( $field['choices']['font-size'] ) && $field['choices']['font-size'] ) ) ? true : false; $args['font-family'] = ( isset( $args['default']['font-family'] ) || ( isset( $field['choices']['font-family'] ) && $field['choices']['font-family'] ) ) ? true : false; $args['line-height'] = ( isset( $args['default']['line-height'] ) || ( isset( $field['choices']['line-height'] ) && $field['choices']['line-height'] ) ) ? true : false; $args['word-spacing'] = ( isset( $args['default']['word-spacing'] ) || ( isset( $field['choices']['word-spacing'] ) && $field['choices']['word-spacing'] ) ) ? true : false; $args['letter-spacing'] = ( isset( $args['default']['word-spacing'] ) || ( isset( $field['choices']['letter-spacing'] ) && $field['choices']['letter-spacing'] ) ) ? true : false; $args['text-align'] = ( isset( $args['default']['text-align'] ) || ( isset( $field['choices']['text-align'] ) && $field['choices']['text-align'] ) ) ? true : false; $args['text-transform'] = ( isset( $args['default']['text-transform'] ) || ( isset( $field['choices']['text-transform'] ) && $field['choices']['text-transform'] ) ) ? true : false; $args['color'] = ( isset( $args['default']['color'] ) || ( isset( $field['choices']['color'] ) && $field['choices']['color'] ) ) ? true : false; $args['margin-top'] = ( isset( $args['default']['margin-top'] ) || ( isset( $field['choices']['margin-top'] ) && $field['choices']['margin-top'] ) ) ? true : false; $args['margin-bottom'] = ( isset( $args['default']['margin-bottom'] ) || ( isset( $field['choices']['margin-bottom'] ) && $field['choices']['margin-bottom'] ) ) ? true : false; $args['select3'] = [ 'allowClear' => false, ]; $args['validate_callback'] = 'fusion_fusionredux_validate_typography'; break; case 'repeater': $args['fields'] = []; $args['group_values'] = true; $args['sortable'] = true; $i = 0; foreach ( $field['fields'] as $repeater_field_id => $repeater_field_args ) { $repeater_field_args['label'] = ( isset( $repeater_field_args['label'] ) ) ? $repeater_field_args['label'] : ''; $args['fields'][ $i ] = [ 'id' => $repeater_field_id, 'type' => isset( $repeater_field_args['type'] ) ? $repeater_field_args['type'] : 'text', 'title' => $repeater_field_args['label'], 'placeholder' => ( isset( $repeater_field_args['default'] ) ) ? $repeater_field_args['default'] : $repeater_field_args['label'], ]; if ( isset( $repeater_field_args['choices'] ) ) { $args['fields'][ $i ]['options'] = $repeater_field_args['choices']; } if ( isset( $repeater_field_args['type'] ) && 'select' === $repeater_field_args['type'] ) { $args['fields'][ $i ]['width'] = 'width:100%;'; $args['fields'][ $i ]['select3'] = [ 'minimumResultsForSearch' => '-1', ]; } if ( isset( $repeater_field_args['type'] ) && 'color' === $repeater_field_args['type'] ) { $args['fields'][ $i ]['transparent'] = false; } if ( isset( $repeater_field_args['type'] ) && ( 'upload' === $repeater_field_args['type'] || 'media' === $repeater_field_args['type'] ) ) { $args['fields'][ $i ]['type'] = 'media'; if ( isset( $repeater_field_args['mode'] ) ) { $args['fields'][ $i ]['mode'] = $repeater_field_args['mode']; } if ( isset( $repeater_field_args['preview'] ) ) { $args['fields'][ $i ]['preview'] = $repeater_field_args['preview']; } } $i++; } unset( $args['options'] ); if ( 'custom_fonts' === $field['id'] ) { $args['validate_callback'] = 'fusion_fusionredux_validate_custom_fonts'; } break; case 'accordion': $args['type'] = 'accordion'; $args['title'] = $field['label']; $args['subtitle'] = ( isset( $field['description'] ) ) ? $field['description'] : ''; unset( $field['fields'] ); unset( $field['label'] ); unset( $field['default'] ); unset( $field['options'] ); break; case 'custom': $args['type'] = 'raw'; $args['full_width'] = isset( $field['subtitle'] ) ? false : true; if ( isset( $field['style'] ) && 'heading' === $field['style'] ) { $args['content'] = '
' . $field['description'] . '