%PDF- %PDF-
| Direktori : /dom645759/wp-content/plugins/fusion-builder/shortcodes/ |
| Current File : /dom645759/wp-content/plugins/fusion-builder/shortcodes/fusion-tabs.php |
<?php
/**
* Add an element to fusion-builder.
*
* @package fusion-builder
* @since 1.0
*/
if ( fusion_is_element_enabled( 'fusion_tabs' ) ) {
if ( ! class_exists( 'FusionSC_Tabs' ) ) {
/**
* Shortcode class.
*
* @since 1.0
*/
class FusionSC_Tabs extends Fusion_Element {
/**
* Tabs counter.
*
* @access private
* @since 1.0
* @var int
*/
private $tabs_counter = 1;
/**
* Tab counter.
*
* @access private
* @since 1.0
* @var int
*/
private $tab_counter = 1;
/**
* Array of our tabs.
*
* @access private
* @since 1.0
* @var array
*/
private $tabs = [];
/**
* Whether the tab is active or not.
*
* @access private
* @since 1.0
* @var bool
*/
private $active = false;
/**
* Parent SC arguments.
*
* @access protected
* @since 1.0
* @var array
*/
protected $parent_args;
/**
* Child SC arguments.
*
* @access protected
* @since 1.0
* @var array
*/
protected $child_args;
/**
* Parent fusion_tabs SC arguments.
*
* @access protected
* @since 1.0
* @var array
*/
protected $fusion_tabs_args;
/**
* Child fusion_tab SC arguments.
*
* @access protected
* @since 1.0
* @var array
*/
protected $fusion_tab_args;
/**
* Constructor.
*
* @access public
* @since 1.0
*/
public function __construct() {
parent::__construct();
add_filter( 'fusion_attr_tabs-shortcode', [ $this, 'attr' ] );
add_filter( 'fusion_attr_tabs-shortcode-navtabs', [ $this, 'navtabs_attr' ] );
add_filter( 'fusion_attr_tabs-shortcode-link', [ $this, 'link_attr' ] );
add_filter( 'fusion_attr_tabs-shortcode-icon', [ $this, 'icon_attr' ] );
add_filter( 'fusion_attr_tabs-shortcode-tab', [ $this, 'tab_attr' ] );
add_shortcode( 'fusion_old_tabs', [ $this, 'render_parent' ] );
add_shortcode( 'fusion_old_tab', [ $this, 'render_child' ] );
add_shortcode( 'fusion_tabs', [ $this, 'fusion_tabs' ] );
add_shortcode( 'fusion_tab', [ $this, 'fusion_tab' ] );
}
/**
* Gets the default values.
*
* @static
* @access public
* @since 2.0.0
* @param 'parent'|'child' $context Whether we want parent or child.
* @return array
*/
public static function get_element_defaults( $context = 'parent' ) {
$fusion_settings = awb_get_fusion_settings();
$border_radius = Fusion_Builder_Border_Radius_Helper::get_border_radius_array_with_fallback_value( $fusion_settings->get( 'tabs_title_border_radius' ) );
$parent = [
'hide_on_mobile' => fusion_builder_default_visibility( 'string' ),
'class' => '',
'id' => '',
'backgroundcolor' => $fusion_settings->get( 'tabs_bg_color' ),
'title_border_radius_top_left' => $border_radius['top_left'],
'title_border_radius_top_right' => $border_radius['top_right'],
'title_border_radius_bottom_right' => $border_radius['bottom_right'],
'title_border_radius_bottom_left' => $border_radius['bottom_left'],
'bordercolor' => $fusion_settings->get( 'tabs_border_color' ),
'active_border_color' => $fusion_settings->get( 'primary_color' ),
'active_border_size' => $fusion_settings->get( 'tabs_active_border_size' ),
'border_size' => '1',
'title_border_size_top' => '',
'title_border_size_right' => '',
'title_border_size_bottom' => '',
'title_border_size_left' => '',
'content_border_size_top' => '',
'content_border_size_right' => '',
'content_border_size_bottom' => '',
'content_border_size_left' => '',
'icon_position' => $fusion_settings->get( 'tabs_icon_position' ),
'icon_size' => $fusion_settings->get( 'tabs_icon_size' ),
'icon_color' => $fusion_settings->get( 'tabs_icon_color' ),
'icon_active_color' => $fusion_settings->get( 'tabs_icon_active_color' ),
'design' => 'classic',
'inactivecolor' => $fusion_settings->get( 'tabs_inactive_color' ),
'title_gradient' => 'no',
'title_gradient_start_color' => '',
'title_gradient_end_color' => '',
'title_active_gradient_start_color' => '',
'title_active_gradient_end_color' => '',
'title_gradient_start_position' => '0',
'title_gradient_end_position' => '100',
'title_gradient_type' => 'linear',
'title_radial_direction' => 'center center',
'title_linear_angle' => '180',
'content_background_color' => '',
'content_border_radius_top_left' => '',
'content_border_radius_top_right' => '',
'content_border_radius_bottom_right' => '',
'content_border_radius_bottom_left' => '',
'justified' => 'yes',
'sticky_tabs' => 'no',
'sticky_tabs_offset' => '',
'update_url' => 'no',
'content_transition' => 'fade',
'content_transition_direction' => 'up',
'content_transition_speed' => '300',
'layout' => 'horizontal',
'alignment' => '',
'title_alignment' => '',
'title_min_width' => '',
'description_font_size' => '',
'description_color' => '',
'fusion_font_family_title_font' => '',
'fusion_font_variant_title_font' => '',
'title_font_size' => '',
'title_line_height' => '',
'title_letter_spacing' => '',
'title_text_transform' => '',
'title_text_color' => $fusion_settings->get( 'tabs_title_color' ),
'title_active_text_color' => $fusion_settings->get( 'tabs_active_title_color' ),
'title_tag' => 'h4',
'title_padding_top' => $fusion_settings->get( 'tabs_title_padding', 'top' ),
'title_padding_right' => $fusion_settings->get( 'tabs_title_padding', 'right' ),
'title_padding_bottom' => $fusion_settings->get( 'tabs_title_padding', 'bottom' ),
'title_padding_left' => $fusion_settings->get( 'tabs_title_padding', 'left' ),
'title_padding_top_medium' => '',
'title_padding_right_medium' => '',
'title_padding_bottom_medium' => '',
'title_padding_left_medium' => '',
'title_padding_top_small' => '',
'title_padding_right_small' => '',
'title_padding_bottom_small' => '',
'title_padding_left_small' => '',
'content_padding_top' => $fusion_settings->get( 'tabs_content_padding', 'top' ),
'content_padding_right' => $fusion_settings->get( 'tabs_content_padding', 'right' ),
'content_padding_bottom' => $fusion_settings->get( 'tabs_content_padding', 'bottom' ),
'content_padding_left' => $fusion_settings->get( 'tabs_content_padding', 'left' ),
'content_padding_top_medium' => '',
'content_padding_right_medium' => '',
'content_padding_bottom_medium' => '',
'content_padding_left_medium' => '',
'content_padding_top_small' => '',
'content_padding_right_small' => '',
'content_padding_bottom_small' => '',
'content_padding_left_small' => '',
'content_height' => '',
'content_height_medium' => '',
'content_height_small' => '',
'mobile_mode' => $fusion_settings->get( 'tabs_mobile_mode', false, 'accordion' ),
'mobile_sticky_tabs' => $fusion_settings->get( 'tabs_mobile_sticky_tabs', false, 'no' ),
// Autoplay.
'autoplay' => 'off',
'autoplay_speed' => $fusion_settings->get( 'tabs_autoplay_speed' ),
'autoplay_pause_on_hover' => 'yes',
'autoplay_resume' => 'no',
'autoplay_pause_button' => 'no',
'autoplay_pause_button_color' => '',
'autoplay_indicator' => 'yes',
'autoplay_indicator_style' => '',
'autoplay_indicator_position' => '',
'autoplay_indicator_color' => $fusion_settings->get( 'tabs_autoplay_indicator_color' ),
'autoplay_track_color' => '',
'autoplay_indicator_size' => $fusion_settings->get( 'tabs_autoplay_indicator_size' ),
// margin.
'margin_top' => '',
'margin_right' => '',
'margin_bottom' => '',
'margin_left' => '',
'margin_top_medium' => '',
'margin_right_medium' => '',
'margin_bottom_medium' => '',
'margin_left_medium' => '',
'margin_top_small' => '',
'margin_right_small' => '',
'margin_bottom_small' => '',
'margin_left_small' => '',
'dynamic_params' => '',
];
$child = [
// Without a title default the live editor template reads an undefined value
// and prints "undefined" in the tab whenever a tab is saved without a title.
'title' => '',
'icon' => 'none',
'id' => '',
'description' => '',
'fusion_tab' => 'no',
];
if ( 'parent' === $context ) {
return $parent;
} elseif ( 'child' === $context ) {
return $child;
}
}
/**
* Maps settings to param variables.
*
* @static
* @access public
* @param string $context Whether we want parent or child.
* @since 2.0.0
* @return array
*/
public static function settings_to_params( $context = '' ) {
$parent = [
'tabs_bg_color' => 'backgroundcolor',
'tabs_border_color' => 'bordercolor',
'tabs_icon_position' => 'icon_position',
'tabs_icon_size' => 'icon_size',
'tabs_inactive_color' => 'inactivecolor',
'tabs_icon_color' => 'icon_color',
'tabs_icon_active_color' => 'icon_active_color',
'tabs_title_color' => 'title_text_color',
'tabs_active_title_color' => 'title_active_text_color',
'tabs_title_padding[top]' => 'title_padding_top',
'tabs_title_padding[right]' => 'title_padding_right',
'tabs_title_padding[bottom]' => 'title_padding_bottom',
'tabs_title_padding[left]' => 'title_padding_left',
'tabs_title_border_radius[top_left]' => 'title_border_radius_top_left',
'tabs_title_border_radius[top_right]' => 'title_border_radius_top_right',
'tabs_title_border_radius[bottom_right]' => 'title_border_radius_bottom_right',
'tabs_title_border_radius[bottom_left]' => 'title_border_radius_bottom_left',
'tabs_content_padding[top]' => 'content_padding_top',
'tabs_content_padding[right]' => 'content_padding_right',
'tabs_content_padding[bottom]' => 'content_padding_bottom',
'tabs_content_padding[left]' => 'content_padding_left',
'tabs_mobile_mode' => 'mobile_mode',
'tabs_mobile_sticky_tabs' => 'mobile_sticky_tabs',
'tabs_active_border_size' => 'active_border_size',
'tabs_autoplay_speed' => 'autoplay_speed',
'tabs_autoplay_indicator_color' => 'autoplay_indicator_color',
'tabs_autoplay_indicator_size' => 'autoplay_indicator_size',
];
$child = [];
if ( 'parent' === $context ) {
return $parent;
} elseif ( 'child' === $context ) {
return $child;
} else {
return [
'parent' => $parent,
'child' => $child,
];
}
}
/**
* Render the parent shortcode.
*
* @access public
* @since 1.0
* @param array $args Shortcode parameters.
* @param string $content Content between shortcode.
* @return string HTML output.
*/
public function render_parent( $args, $content = '' ) {
$html = '';
$defaults = FusionBuilder::set_shortcode_defaults( self::get_element_defaults( 'parent' ), $args );
$this->parent_args = $defaults;
$html = '';
if ( 'yes' === $this->parent_args['sticky_tabs'] && 'horizontal' === $this->parent_args['layout'] ) {
$html .= '<div class="fusion-tabs-sticky-helper" style="height:1px;"></div>';
}
$html .= '<div ' . FusionBuilder::attributes( 'tabs-shortcode' ) . '>' . $this->get_autoplay_controls() . '<div ' . FusionBuilder::attributes( 'nav' ) . '>';
$is_first_tab = true;
if ( empty( $this->tabs ) ) {
$this->parse_tab_parameter( $content, 'fusion_old_tab', $args );
}
if ( strpos( $content, 'fusion_tab' ) ) {
preg_match_all( '/(\[fusion_tab (.*?)\](.*?)\[\/fusion_tab\])/s', $content, $matches );
} else {
preg_match_all( '/(\[fusion_old_tab (.*?)\](.*?)\[\/fusion_old_tab\])/s', $content, $matches );
}
$tab_content = $tab_nav = '';
$tabs_count = ! empty( $this->tabs ) ? count( $this->tabs ) : 0;
$is_vertical = 'vertical' === $this->parent_args['layout'];
for ( $i = 0; $i < $tabs_count; $i++ ) {
$icon = $tab_title = '';
if ( 'none' !== $this->tabs[ $i ]['icon'] ) {
$icon = '<i ' . FusionBuilder::attributes( 'tabs-shortcode-icon', [ 'index' => $i ] ) . '></i>';
}
if ( 'right' === $this->parent_args['icon_position'] ) {
$tab_title = $this->tabs[ $i ]['title'] . $icon;
} else {
$tab_title = $icon . $this->tabs[ $i ]['title'];
}
$title_tag = tag_escape( $this->parent_args['title_tag'] );
$unique_id = $this->tabs[ $i ]['unique_id'];
$tab_id = str_replace( 'tab-', 'fusion-tab-', $unique_id );
$description = $this->get_tab_description( $i );
$tab_nav_item = '<li ' . ( $is_first_tab ? FusionBuilder::attributes( 'active' ) : '' ) . ' role="presentation"><a ' . FusionBuilder::attributes(
'tabs-shortcode-link',
[
'index' => $i,
'tab_id' => $tab_id,
'first' => $is_first_tab ? 'true' : 'false',
]
) . '><' . $title_tag . ' ' . FusionBuilder::attributes( 'fusion-tab-heading' ) . '>' . $tab_title . '</' . $title_tag . '>' . ( $is_vertical ? $description : '' ) . '</a></li>';
$tab_nav .= $tab_nav_item;
$is_first_tab = false;
// Change ID for mobile to ensure no duplicate ID.
$tab_nav_item = str_replace( 'id="fusion-tab-', 'id="mobile-fusion-tab-', $tab_nav_item );
if ( 'accordion' === $this->parent_args['mobile_mode'] || 'toggle' === $this->parent_args['mobile_mode'] ) {
$tab_content .= '<div ' . FusionBuilder::attributes( 'nav fusion-mobile-tab-nav' ) . '><ul ' . FusionBuilder::attributes( 'tabs-shortcode-navtabs' ) . '>' . $tab_nav_item . '</ul></div>';
}
$tab_content .= ( isset( $matches[1][ $i ] ) ) ? do_shortcode( $matches[1][ $i ] ) : '';
}
$html .= '<ul ' . FusionBuilder::attributes( 'tabs-shortcode-navtabs' ) . '>' . $tab_nav . '</ul></div><div ' . FusionBuilder::attributes( 'tab-content' ) . '>' . $tab_content . '</div></div>';
$this->tabs_counter++;
$this->tab_counter = 1;
$this->active = false;
unset( $this->tabs );
$this->on_render();
return apply_filters( 'fusion_element_tabs_parent_content', $html, $args );
}
/**
* Resolves the tab content transition, whitelisted as it becomes a class name.
*
* @access protected
* @since 7.16
* @return string One of 'none', 'fade', 'slide' or 'zoom'.
*/
protected function get_content_transition() {
$transition = $this->parent_args['content_transition'];
return in_array( $transition, [ 'none', 'fade', 'slide', 'zoom' ], true ) ? $transition : 'fade';
}
/**
* Resolves which way the slide transition travels.
*
* @access protected
* @since 7.16
* @return string One of 'up', 'down', 'left' or 'right'.
*/
protected function get_content_transition_direction() {
$direction = $this->parent_args['content_transition_direction'];
return in_array( $direction, [ 'up', 'down', 'left', 'right' ], true ) ? $direction : 'up';
}
/**
* Builds the short description for a tab, if it has one.
*
* The wrapper animates grid-template-rows from 0fr to 1fr, which is
* how it slides open to an intrinsic height.
*
* @access protected
* @since 7.16
* @param int $index The tab index.
* @return string
*/
protected function get_tab_description( $index ) {
$description = isset( $this->tabs[ $index ]['description'] ) ? $this->tabs[ $index ]['description'] : '';
if ( '' === trim( $description ) ) {
return '';
}
return '<div class="awb-tab-description"><div class="awb-tab-description-inner">' . wp_kses_post( $description ) . '</div></div>';
}
/**
* Builds the CSS value for the tab gradient.
*
* The shared helper only speaks the unprefixed gradient_* names, so the
* prefixed tab params are mapped back onto them. The active state reuses
* the regular geometry and only overrides the two colors.
*
* @access protected
* @since 7.16
* @param string $prefix Param name prefix, currently only 'title_'.
* @param string $state Empty for the regular state, or 'active'.
* @return string A gradient value, or an empty string when unset.
*/
protected function get_gradient_value( $prefix, $state = '' ) {
$color_prefix = '' === $state ? $prefix : $prefix . $state . '_';
$start = $this->parent_args[ $color_prefix . 'gradient_start_color' ];
$end = $this->parent_args[ $color_prefix . 'gradient_end_color' ];
// A fully transparent gradient is the same as none at all. The helper
// only tests for an empty string, so alpha is checked here instead.
$has_start = '' !== $start && 0 < Fusion_Color::new_color( $start )->alpha;
$has_end = '' !== $end && 0 < Fusion_Color::new_color( $end )->alpha;
if ( ! $has_start && ! $has_end ) {
return '';
}
return Fusion_Builder_Gradient_Helper::get_gradient_font_string(
[
'gradient_start_color' => $start,
'gradient_end_color' => $end,
'gradient_start_position' => $this->parent_args[ $prefix . 'gradient_start_position' ],
'gradient_end_position' => $this->parent_args[ $prefix . 'gradient_end_position' ],
'gradient_type' => $this->parent_args[ $prefix . 'gradient_type' ],
'linear_angle' => $this->parent_args[ $prefix . 'linear_angle' ],
'radial_direction' => $this->parent_args[ $prefix . 'radial_direction' ],
],
true
);
}
/**
* Resolves where auto rotation is allowed to run.
*
* 'yes' and 'no' are the param's original values and still understood.
*
* @access protected
* @since 7.16
* @return string One of 'off', 'desktop', 'mobile' or 'both'.
*/
protected function get_autoplay_mode() {
$mode = $this->parent_args['autoplay'];
if ( 'yes' === $mode ) {
return 'both';
}
return in_array( $mode, [ 'desktop', 'mobile', 'both' ], true ) ? $mode : 'off';
}
/**
* Resolves whether the progress is drawn as a line or a background fill.
*
* Empty means "default": a line on classic, drawn over the accent edge
* it already has, and a background fill on clean, which has none.
*
* @access protected
* @since 7.16
* @return string Either 'background' or 'line'.
*/
protected function get_autoplay_indicator_style() {
$style = $this->parent_args['autoplay_indicator_style'];
if ( in_array( $style, [ 'background', 'line' ], true ) ) {
return $style;
}
return ( 'classic' === $this->parent_args['design'] ) ? 'line' : 'background';
}
/**
* Resolves which edge the rotation progress line runs along.
*
* Empty means "default": the leading edge on vertical tabs, the bottom
* edge on horizontal ones. Whitelisted as it becomes a class name.
*
* @access protected
* @since 7.16
* @return string One of 'top', 'bottom', 'start' or 'end'.
*/
protected function get_autoplay_indicator_position() {
$position = $this->parent_args['autoplay_indicator_position'];
if ( in_array( $position, [ 'top', 'bottom', 'start', 'end' ], true ) ) {
return $position;
}
return ( 'vertical' === $this->parent_args['layout'] ) ? 'start' : 'bottom';
}
/**
* Builds the autoplay play/pause control.
*
* Both labels are rendered and toggled with CSS, so the button's
* accessible name changes without any JS string handling.
*
* @access protected
* @since 7.16
* @return string HTML output.
*/
protected function get_autoplay_controls() {
if ( 'off' === $this->get_autoplay_mode() || 'yes' !== $this->parent_args['autoplay_pause_button'] ) {
return '';
}
return '<div class="awb-tabs-autoplay-controls"><button type="button" class="awb-tabs-autoplay-toggle"><span class="awb-tabs-autoplay-toggle-icon" aria-hidden="true"></span><span class="awb-tabs-autoplay-toggle-label awb-tabs-autoplay-toggle-label-pause">' . esc_html__( 'Pause', 'fusion-builder' ) . '</span><span class="awb-tabs-autoplay-toggle-label awb-tabs-autoplay-toggle-label-play">' . esc_html__( 'Play', 'fusion-builder' ) . '</span></button></div>';
}
/**
* Whether one of the border radius sets is rounded at any corner.
*
* Rounded corners need corrections that square ones must not get, and
* CSS cannot ask whether a radius was set, so each set gets a class.
*
* @access protected
* @since 7.16
* @param string $prefix Param name prefix, 'title_' or 'content_'.
* @return bool
*/
protected function has_radius( $prefix ) {
foreach ( [ 'top_left', 'top_right', 'bottom_right', 'bottom_left' ] as $corner ) {
$value = trim( (string) $this->parent_args[ $prefix . 'border_radius_' . $corner ] );
// The unit does not matter, only whether it amounts to zero.
if ( '' !== $value && 0 !== (int) round( (float) $value * 1000 ) ) {
return true;
}
}
return false;
}
/**
* Builds the attributes array.
*
* @access public
* @since 1.0
* @return array
*/
public function attr() {
$attr = fusion_builder_visibility_atts(
$this->parent_args['hide_on_mobile'],
[
'class' => 'fusion-tabs fusion-tabs-' . $this->tabs_counter . ' ' . $this->parent_args['design'],
'style' => '',
]
);
if ( 'yes' !== $this->parent_args['justified'] && 'vertical' !== $this->parent_args['layout'] ) {
$attr['class'] .= ' nav-not-justified';
}
if ( 'yes' === $this->parent_args['justified'] && 'vertical' !== $this->parent_args['layout'] ) {
$attr['class'] .= ' nav-is-justified';
}
$transition = $this->get_content_transition();
if ( 'none' !== $transition ) {
$attr['class'] .= ' awb-tabs-transition awb-tabs-transition-' . $transition;
if ( 'slide' === $transition ) {
$attr['class'] .= ' awb-tabs-transition-dir-' . $this->get_content_transition_direction();
}
}
if ( 'yes' === $this->parent_args['sticky_tabs'] && 'horizontal' === $this->parent_args['layout'] ) {
$attr['class'] .= ' sticky-tabs';
if ( '' !== $this->parent_args['sticky_tabs_offset'] && 0 !== $this->parent_args['sticky_tabs_offset'] ) {
// If its not a selector then get value and set to css variable.
if ( false === strpos( $this->parent_args['sticky_tabs_offset'], '.' ) && false === strpos( $this->parent_args['sticky_tabs_offset'], '#' ) ) {
$attr['style'] .= '--awb-sticky-tabs-offset:' . fusion_library()->sanitize->get_value_with_unit( $this->parent_args['sticky_tabs_offset'] ) . ';';
} else {
$attr['data-sticky-offset'] = (string) $this->parent_args['sticky_tabs_offset'];
}
}
}
if ( 'yes' === $this->parent_args['update_url'] ) {
$attr['class'] .= ' awb-tabs-update-url';
}
if ( $this->parent_args['class'] ) {
$attr['class'] .= ' ' . $this->parent_args['class'];
}
if ( $this->has_radius( 'title_' ) ) {
$attr['class'] .= ' awb-tabs-title-radius';
}
if ( $this->has_radius( 'content_' ) ) {
$attr['class'] .= ' awb-tabs-content-radius';
}
$attr['class'] .= ( 'vertical' === $this->parent_args['layout'] ) ? ' vertical-tabs' : ' horizontal-tabs';
$attr['class'] .= ( '' !== $this->parent_args['icon_position'] ) ? ' icon-position-' . $this->parent_args['icon_position'] : '';
if ( $this->parent_args['id'] ) {
$attr['id'] = $this->parent_args['id'];
}
if ( '' !== $this->parent_args['mobile_mode'] ) {
$attr['class'] .= ' mobile-mode-' . $this->parent_args['mobile_mode'];
}
if ( 'carousel' === $this->parent_args['mobile_mode'] && 'yes' === $this->parent_args['mobile_sticky_tabs'] ) {
$attr['class'] .= ' mobile-sticky-tabs';
}
$autoplay_mode = $this->get_autoplay_mode();
if ( 'off' !== $autoplay_mode ) {
$attr['class'] .= ' awb-tabs-autoplay';
// The JS uses these to decide whether the current viewport rotates.
if ( 'mobile' !== $autoplay_mode ) {
$attr['class'] .= ' awb-tabs-autoplay-desktop';
}
if ( 'desktop' !== $autoplay_mode ) {
$attr['class'] .= ' awb-tabs-autoplay-mobile';
}
if ( 'yes' === $this->parent_args['autoplay_indicator'] ) {
$attr['class'] .= ' awb-tabs-autoplay-indicator';
if ( 'line' === $this->get_autoplay_indicator_style() ) {
$attr['class'] .= ' awb-tabs-autoplay-indicator-line';
// Classic draws its line over the accent border, which is already fixed to one edge.
if ( 'clean' === $this->parent_args['design'] ) {
$attr['class'] .= ' awb-tabs-autoplay-indicator-pos-' . $this->get_autoplay_indicator_position();
}
}
}
if ( 'yes' === $this->parent_args['autoplay_pause_on_hover'] ) {
$attr['class'] .= ' awb-tabs-autoplay-pause-on-hover';
}
if ( 'yes' === $this->parent_args['autoplay_resume'] ) {
$attr['class'] .= ' awb-tabs-autoplay-resume';
}
if ( 'yes' === $this->parent_args['autoplay_pause_button'] ) {
$attr['class'] .= ' awb-tabs-autoplay-has-controls';
}
}
if ( ! empty( $this->parent_args['icon_color'] ) ) {
$attr['style'] .= '--icon-color:' . $this->parent_args['icon_color'] . ';';
}
if ( ! empty( $this->parent_args['icon_active_color'] ) ) {
$attr['style'] .= '--icon-active-color:' . $this->parent_args['icon_active_color'] . ';';
}
$attr['style'] .= $this->get_style_variables();
return $attr;
}
/**
* Builds the attributes array.
*
* @param array $atts The attributes array.
* @access public
* @since 1.0
* @return array
*/
public function navtabs_attr( $atts ) {
$justified_class = '';
if ( 'yes' === $this->parent_args['justified'] && 'vertical' !== $this->parent_args['layout'] ) {
$justified_class = ' nav-justified';
}
$attr['class'] = 'nav-tabs' . $justified_class;
$attr['role'] = 'tablist';
$attr['aria-orientation'] = $this->parent_args['layout'];
return $attr;
}
/**
* Builds the link attributes array.
*
* @access public
* @since 1.0
* @param array $atts Default attributes.
* @return array
*/
public function link_attr( $atts ) {
$index = $atts['index'];
$attr = [
'class' => 'tab-link',
'data-toggle' => 'tab',
'role' => 'tab',
'aria-controls' => $this->tabs[ $index ]['unique_id'],
'aria-selected' => $atts['first'],
];
if ( 'false' === $atts['first'] ) {
$attr['tabindex'] = '-1';
} else {
$attr['tabindex'] = '0';
}
$attr['id'] = $atts['tab_id'];
$attr['href'] = '#' . $this->tabs[ $index ]['unique_id'];
return $attr;
}
/**
* Builds the icon attributes array.
*
* @access public
* @since 1.0
* @param array $atts Default attributes.
* @return array
*/
public function icon_attr( $atts ) {
$index = $atts['index'];
$attr = [
'class' => 'fontawesome-icon ' . fusion_font_awesome_name_handler( $this->tabs[ $index ]['icon'] ),
'aria-hidden' => 'true',
'style' => '',
];
if ( '' !== $this->parent_args['icon_size'] ) {
$attr['style'] .= 'font-size:' . $this->parent_args['icon_size'] . 'px;';
}
$icon_color = ! empty( $this->tabs[ $index ]['icon_color'] ) ? $this->tabs[ $index ]['icon_color'] : '';
if ( $icon_color ) {
$attr['style'] .= ' --icon-color:' . $icon_color . ';';
}
$icon_active_color = ! empty( $this->tabs[ $index ]['icon_active_color'] ) ? $this->tabs[ $index ]['icon_active_color'] : '';
if ( $icon_active_color ) {
$attr['style'] .= '--icon-active-color:' . $icon_active_color . ';';
}
return $attr;
}
/**
* Render the child shortcode.
*
* @access public
* @since 1.0
* @param array $args Shortcode parameters.
* @param string $content Content between shortcode.
* @return string HTML output.
*/
public function render_child( $args, $content = '' ) {
$this->maybe_set_orphan_parent_args();
$defaults = FusionBuilder::set_shortcode_defaults(
[
'icon' => 'none',
'id' => '',
'fusion_tab' => 'no',
'tab_counter' => 1,
],
$args
);
$this->child_args = $defaults;
// A horizontal tab row cannot grow a single tab without going ragged, so
// the description opens the panel instead of sitting in the tab.
$lead = '';
if ( 'vertical' !== $this->parent_args['layout'] ) {
// Same index resolution as tab_attr(): counter for the current shortcode, id for the legacy one.
$index = 'yes' === $this->child_args['fusion_tab'] ? (int) $this->child_args['tab_counter'] - 1 : (int) $this->child_args['id'] - 1;
$lead = $this->get_tab_description( $index );
}
$inner = $lead . do_shortcode( $content );
// Transitions run on an inner wrapper rather than on the pane, so the panel
// frame and background stay put. Omitted entirely when there is no transition.
if ( 'none' !== $this->get_content_transition() ) {
$inner = '<div class="awb-tab-pane-inner">' . $inner . '</div>';
}
$html = '<div ' . FusionBuilder::attributes( 'tabs-shortcode-tab' ) . '>' . $inner . '</div>';
return apply_filters( 'fusion_element_tabs_child_content', $html, $args );
}
/**
* Builds the tab attributes array.
*
* @access public
* @since 1.0
* @return array
*/
public function tab_attr() {
$index = $this->child_args['tab_counter'] - 1;
// awb-tab.js reads the fade class as "this pane has a transition" and waits for it.
$fade = 'none' === $this->get_content_transition() ? '' : ' fade';
$attr = [
'class' => 'tab-pane' . $fade . ' fusion-clearfix',
'role' => 'tabpanel',
'tabindex' => '0',
'aria-labelledby' => isset( $this->tabs[ $index ] ) ? str_replace( 'tab-', 'fusion-tab-', $this->tabs[ $index ]['unique_id'] ) : '', // isset check needed for Yoast's page analysis tool.
];
if ( ! isset( $this->active ) ) {
$this->active = false;
}
if ( ! $this->active ) {
$attr['class'] = 'tab-pane' . $fade . ' fusion-clearfix in active';
$this->active = true;
}
if ( 'yes' === $this->child_args['fusion_tab'] ) {
$attr['id'] = $this->child_args['id'];
} else {
$index = $this->child_args['id'] - 1;
$attr['id'] = $this->tabs[ $index ]['unique_id'];
}
return $attr;
}
/**
* Returns the fusion-tabs.
*
* @access public
* @since 1.0
* @param array $atts The attributes.
* @param null|string $content The content.
* @return string
*/
public function fusion_tabs( $atts, $content = null ) {
$fusion_settings = awb_get_fusion_settings();
$border_radius = Fusion_Builder_Border_Radius_Helper::get_border_radius_array_with_fallback_value( $fusion_settings->get( 'tabs_title_border_radius' ) );
$defaults = FusionBuilder::set_shortcode_defaults(
[
'class' => '',
'id' => '',
'backgroundcolor' => $fusion_settings->get( 'tabs_bg_color' ),
'bordercolor' => $fusion_settings->get( 'tabs_border_color' ),
'title_border_radius_top_left' => $border_radius['top_left'],
'title_border_radius_top_right' => $border_radius['top_right'],
'title_border_radius_bottom_right' => $border_radius['bottom_right'],
'title_border_radius_bottom_left' => $border_radius['bottom_left'],
'active_border_color' => $fusion_settings->get( 'primary_color' ),
'active_border_size' => $fusion_settings->get( 'tabs_active_border_size' ),
'border_size' => '1',
'title_border_size_top' => '',
'title_border_size_right' => '',
'title_border_size_bottom' => '',
'title_border_size_left' => '',
'content_border_size_top' => '',
'content_border_size_right' => '',
'content_border_size_bottom' => '',
'content_border_size_left' => '',
'icon' => '',
'icon_position' => $fusion_settings->get( 'tabs_icon_position' ),
'icon_size' => $fusion_settings->get( 'tabs_icon_size' ),
'icon_color' => $fusion_settings->get( 'tabs_icon_color' ),
'icon_active_color' => $fusion_settings->get( 'tabs_icon_active_color' ),
'design' => 'classic',
'inactivecolor' => $fusion_settings->get( 'tabs_inactive_color' ),
'title_gradient' => 'no',
'title_gradient_start_color' => '',
'title_gradient_end_color' => '',
'title_active_gradient_start_color' => '',
'title_active_gradient_end_color' => '',
'title_gradient_start_position' => '0',
'title_gradient_end_position' => '100',
'title_gradient_type' => 'linear',
'title_radial_direction' => 'center center',
'title_linear_angle' => '180',
'content_background_color' => '',
'content_border_radius_top_left' => '',
'content_border_radius_top_right' => '',
'content_border_radius_bottom_right' => '',
'content_border_radius_bottom_left' => '',
'justified' => 'yes',
'alignment' => '',
'title_alignment' => '',
'title_min_width' => '',
'description_font_size' => '',
'description_color' => '',
'sticky_tabs' => 'no',
'sticky_tabs_offset' => '',
'update_url' => 'no',
'content_transition' => 'fade',
'content_transition_direction' => 'up',
'content_transition_speed' => '300',
'layout' => 'horizontal',
'hide_on_mobile' => fusion_builder_default_visibility( 'string' ),
'fusion_font_family_title_font' => '',
'fusion_font_variant_title_font' => '',
'title_font_size' => '',
'title_line_height' => '',
'title_letter_spacing' => '',
'title_text_transform' => '',
'title_text_color' => '',
'title_active_text_color' => '',
'title_tag' => '',
'title_padding_top' => '',
'title_padding_right' => '',
'title_padding_bottom' => '',
'title_padding_left' => '',
'title_padding_top_medium' => '',
'title_padding_right_medium' => '',
'title_padding_bottom_medium' => '',
'title_padding_left_medium' => '',
'title_padding_top_small' => '',
'title_padding_right_small' => '',
'title_padding_bottom_small' => '',
'title_padding_left_small' => '',
'content_padding_top' => '',
'content_padding_right' => '',
'content_padding_bottom' => '',
'content_padding_left' => '',
'content_padding_top_medium' => '',
'content_padding_right_medium' => '',
'content_padding_bottom_medium' => '',
'content_padding_left_medium' => '',
'content_padding_top_small' => '',
'content_padding_right_small' => '',
'content_padding_bottom_small' => '',
'content_padding_left_small' => '',
'content_height' => '',
'content_height_medium' => '',
'content_height_small' => '',
'mobile_mode' => '',
'mobile_sticky_tabs' => '',
// Autoplay.
'autoplay' => 'off',
'autoplay_speed' => $fusion_settings->get( 'tabs_autoplay_speed' ),
'autoplay_pause_on_hover' => 'yes',
'autoplay_resume' => 'no',
'autoplay_pause_button' => 'no',
'autoplay_pause_button_color' => '',
'autoplay_indicator' => 'yes',
'autoplay_indicator_style' => '',
'autoplay_indicator_position' => '',
'autoplay_indicator_color' => '',
'autoplay_track_color' => '',
'autoplay_indicator_size' => $fusion_settings->get( 'tabs_autoplay_indicator_size' ),
// margin.
'margin_top' => '',
'margin_right' => '',
'margin_bottom' => '',
'margin_left' => '',
'margin_top_medium' => '',
'margin_right_medium' => '',
'margin_bottom_medium' => '',
'margin_left_medium' => '',
'margin_top_small' => '',
'margin_right_small' => '',
'margin_bottom_small' => '',
'margin_left_small' => '',
'dynamic_params' => '',
],
$atts,
'fusion_tabs'
);
$this->fusion_tabs_args = $defaults;
$atts = $defaults;
$dynamic_data = json_decode( fusion_decode_if_needed( $atts['dynamic_params'] ), true );
if ( isset( $dynamic_data['parent_dynamic_content'] ) ) {
$content = self::get_acf_repeater( $dynamic_data['parent_dynamic_content'], $atts, $content, false );
}
$content = preg_replace( '/tab\][^\[]*/', 'tab]', $content );
$content = preg_replace( '/^[^\[]*\[/', '[', $content );
$this->parse_tab_parameter( $content, 'fusion_tab' );
$shortcode_wrapper = '[fusion_old_tabs ';
foreach ( $atts as $key => $value ) {
$shortcode_wrapper .= $key . '="' . $value . '" ';
}
$shortcode_wrapper .= ']';
$shortcode_wrapper .= $content;
$shortcode_wrapper .= '[/fusion_old_tabs]';
fusion_element_rendering_elements( true );
$html = do_shortcode( $shortcode_wrapper );
fusion_element_rendering_elements( false );
return $html;
}
/**
* Returns the fusion-tab.
*
* @access public
* @since 1.0
* @param array $atts The attributes.
* @param null|string $content The content.
* @return string
*/
public function fusion_tab( $atts, $content = null ) {
if ( $this->maybe_set_orphan_parent_args( 'fusion_tabs_args' ) ) {
$this->fusion_tabs_args['icon'] = '';
}
$defaults = FusionBuilder::set_shortcode_defaults(
[
'id' => '',
'icon' => $this->fusion_tabs_args['icon'],
'icon_color' => $this->fusion_tabs_args['icon_color'],
'icon_active_color' => $this->fusion_tabs_args['icon_active_color'],
'title' => '',
],
$atts,
'fusion_tab'
);
$content = apply_filters( 'fusion_shortcode_content', $content, 'fusion_tab', $atts );
$this->fusion_tab_args = $defaults;
$atts = $defaults;
// Create unique tab id for linking.
$sanitized_title = hash( 'md5', $defaults['title'], false );
$sanitized_title = 'tab' . str_replace( '-', '_', $sanitized_title );
$unique_id = 'tab-' . substr( md5( get_the_ID() . '-' . $this->tabs_counter . '-' . $this->tab_counter . '-' . $sanitized_title ), 13 );
$shortcode_wrapper = '[fusion_old_tab id="' . $unique_id . '" icon="' . $defaults['icon'] . '" icon_color="' . $defaults['icon_color'] . '" icon_active_color="' . $defaults['icon_active_color'] . '" fusion_tab="yes" tab_counter="' . $this->tab_counter . '" title="' . $defaults['title'] . '"]' . do_shortcode( $content ) . '[/fusion_old_tab]';
$this->tab_counter++;
return do_shortcode( $shortcode_wrapper );
}
/**
* Parses the tab parameters.
*
* @access public
* @since 1.0
* @param string $content The content.
* @param string $shortcode The shortcode.
* @param array $args The arguments.
*/
public function parse_tab_parameter( $content, $shortcode, $args = null ) {
$preg_match_tabs_single = preg_match_all( FusionBuilder::get_shortcode_regex( $shortcode ), $content, $tabs_single );
if ( is_array( $tabs_single[0] ) ) {
foreach ( array_keys( $tabs_single[0] ) as $key ) {
// Group 3 of the shortcode regex is this tab's own attribute string, so it is parsed
// the same way WP parses it before handing it to the shortcode callback.
$tab_atts = shortcode_parse_atts( isset( $tabs_single[3][ $key ] ) ? $tabs_single[3][ $key ] : '' );
$tab_atts = is_array( $tab_atts ) ? $tab_atts : [];
if ( is_array( $args ) ) {
$id = isset( $tab_atts['id'] ) ? $tab_atts['id'] : '';
$title = '';
foreach ( $args as $args_key => $value ) {
if ( 'tab' . $id === $args_key ) {
$title = $value;
}
}
} else {
$title = isset( $tab_atts['title'] ) ? $tab_atts['title'] : '';
}
// "none" is what the builder stores for a tab that has no icon of its own, so it stays
// the trigger for the parent icon rather than an opt out of it.
$icon = isset( $tab_atts['icon'] ) && '' !== $tab_atts['icon'] ? $tab_atts['icon'] : 'none';
if ( 'none' === $icon && ! empty( $this->fusion_tabs_args['icon'] ) ) {
$icon = $this->fusion_tabs_args['icon'];
}
$icon_color = isset( $tab_atts['icon_color'] ) ? $tab_atts['icon_color'] : '';
$icon_active_color = isset( $tab_atts['icon_active_color'] ) ? $tab_atts['icon_active_color'] : '';
$description = isset( $tab_atts['description'] ) ? $tab_atts['description'] : '';
// Create unique tab id for linking.
$sanitized_title = hash( 'md5', $title, false );
$sanitized_title = 'tab' . str_replace( '-', '_', $sanitized_title );
$unique_id = 'tab-' . substr( md5( get_the_ID() . '-' . $this->tabs_counter . '-' . $this->tab_counter . '-' . $sanitized_title ), 13 );
// Create array for every single tab shortcode.
$this->tabs[] = [
'title' => $title,
'icon' => $icon,
'icon_color' => $icon_color,
'icon_active_color' => $icon_active_color,
'description' => $description,
'unique_id' => $unique_id,
];
$this->tab_counter++;
}
$this->tab_counter = 1;
}
}
/**
* Adds settings to element options panel.
*
* @access public
* @since 1.1
* @return array $sections Tabs settings.
*/
public function add_options() {
return [
'tabs_shortcode_section' => [
'label' => esc_html__( 'Tabs', 'fusion-builder' ),
'description' => '',
'id' => 'tabs_shortcode_section',
'icon' => 'fusiona-folder',
'type' => 'accordion',
'fields' => [
'tabs_info' => [
'id' => 'social_links_info',
'type' => 'custom',
'description' => '<div class="fusion-redux-important-notice">' . __( '<strong>IMPORTANT NOTE:</strong> These tab global options control both the tab element and Avada tab widget, however the widget does not utilize icons.', 'fusion-builder' ) . '</div>',
],
'tabs_bg_color' => [
'label' => esc_html__( 'Tabs Background Color + Hover Color', 'fusion-builder' ),
'description' => esc_html__( 'Controls the color of the active tab, tab hover and content background.', 'fusion-builder' ),
'id' => 'tabs_bg_color',
'default' => 'var(--awb-color1)',
'type' => 'color-alpha',
'transport' => 'postMessage',
'css_vars' => [
[
'name' => '--tabs_bg_color',
'callback' => [ 'sanitize_color' ],
],
],
],
'tabs_inactive_color' => [
'label' => esc_html__( 'Tabs Inactive Color', 'fusion-builder' ),
'description' => esc_html__( 'Controls the color of the inactive tabs as well as the post date box layout for the Avada Tab Widget.', 'fusion-builder' ),
'id' => 'tabs_inactive_color',
'default' => 'var(--awb-color2)',
'type' => 'color-alpha',
'transport' => 'postMessage',
'css_vars' => [
[
'name' => '--tabs_inactive_color',
'callback' => [ 'sanitize_color' ],
],
],
],
'tabs_title_border_radius' => [
'label' => esc_html__( 'Tabs Title Border Radius', 'fusion-builder' ),
'description' => esc_html__( 'Controls the border radius of tabs title.', 'fusion-builder' ),
'id' => 'tabs_title_border_radius',
'type' => 'border_radius',
'transport' => 'postMessage',
'choices' => [
'top_left' => true,
'top_right' => true,
'bottom_right' => true,
'bottom_left' => true,
'units' => [ 'px', '%', 'em' ],
],
'default' => [
'top_left' => '0px',
'top_right' => '0px',
'bottom_right' => '0px',
'bottom_left' => '0px',
],
'css_vars' => [
[
'name' => '--awb-tabs-title-border-top-left-radius-default',
'choice' => 'top_left',
'element' => 'body',
],
[
'name' => '--awb-tabs-title-border-top-right-radius-default',
'choice' => 'top_right',
'element' => 'body',
],
[
'name' => '--awb-tabs-title-border-bottom-right-radius-default',
'choice' => 'bottom_right',
'element' => 'body',
],
[
'name' => '--awb-tabs-title-border-bottom-left-radius-default',
'choice' => 'bottom_left',
'element' => 'body',
],
],
],
'tabs_border_color' => [
'label' => esc_html__( 'Tabs Border Color', 'fusion-builder' ),
'description' => esc_html__( 'Controls the color of the tab border.', 'fusion-builder' ),
'id' => 'tabs_border_color',
'default' => 'var(--awb-color3)',
'type' => 'color-alpha',
'transport' => 'postMessage',
'css_vars' => [
[
'name' => '--tabs_border_color',
'callback' => [ 'sanitize_color' ],
],
],
],
'tabs_title_padding' => [
'label' => esc_html__( 'Tabs Title Padding', 'fusion-builder' ),
'description' => esc_html__( 'Controls the padding of tabs title.', 'fusion-builder' ),
'id' => 'tabs_title_padding',
'type' => 'spacing',
'transport' => 'postMessage',
'choices' => [
'top' => true,
'left' => true,
'bottom' => true,
'right' => true,
],
'default' => [
'top' => '',
'left' => '',
'bottom' => '',
'right' => '',
],
],
'tabs_content_padding' => [
'label' => esc_html__( 'Tabs Content Padding', 'fusion-builder' ),
'description' => esc_html__( 'Controls the padding of tabs content.', 'fusion-builder' ),
'id' => 'tabs_content_padding',
'type' => 'spacing',
'transport' => 'postMessage',
'choices' => [
'top' => true,
'left' => true,
'bottom' => true,
'right' => true,
],
'default' => [
'top' => '',
'left' => '',
'bottom' => '',
'right' => '',
],
],
'tabs_icon_position' => [
'label' => esc_html__( 'Icon Position', 'fusion-builder' ),
'description' => esc_html__( 'Choose the position of the icon on the tab.', 'fusion-builder' ),
'id' => 'tabs_icon_position',
'default' => 'left',
'type' => 'radio-buttonset',
'transport' => 'postMessage',
'choices' => [
'left' => esc_attr__( 'Left', 'fusion-builder' ),
'right' => esc_attr__( 'Right', 'fusion-builder' ),
'top' => esc_attr__( 'Top', 'fusion-builder' ),
],
],
'tabs_icon_size' => [
'label' => esc_html__( 'Tabs Icon Size', 'fusion-builder' ),
'description' => esc_html__( 'Set the size of the icon.', 'fusion-builder' ),
'id' => 'tabs_icon_size',
'default' => '16',
'transport' => 'postMessage',
'choices' => [
'min' => '1',
'max' => '150',
'step' => '1',
],
'type' => 'slider',
],
'tabs_icon_color' => [
'label' => esc_html__( 'Tabs Icon Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the icon.', 'fusion-builder' ),
'id' => 'tabs_icon_color',
'transport' => 'postMessage',
'type' => 'color-alpha',
],
'tabs_icon_active_color' => [
'label' => esc_html__( 'Active Tab Icon Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the active tab icon.', 'fusion-builder' ),
'id' => 'tabs_icon_active_color',
'transport' => 'postMessage',
'type' => 'color-alpha',
],
'tabs_title_color' => [
'label' => esc_html__( 'Tabs Title Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the tabs title.', 'fusion-builder' ),
'id' => 'tabs_title_color',
'transport' => 'postMessage',
'type' => 'color-alpha',
],
'tabs_active_title_color' => [
'label' => esc_html__( 'Tabs Active Title Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the tabs active title.', 'fusion-builder' ),
'id' => 'tabs_active_title_color',
'transport' => 'postMessage',
'type' => 'color-alpha',
],
'tabs_active_border_size' => [
'label' => esc_html__( 'Tabs Active Border Size', 'fusion-builder' ),
'description' => esc_html__( 'Controls the thickness of the accent border on the active tab for the classic design, in pixels.', 'fusion-builder' ),
'id' => 'tabs_active_border_size',
'default' => '3',
'type' => 'slider',
'choices' => [
'min' => '0',
'max' => '20',
'step' => '1',
],
],
'tabs_autoplay_speed' => [
'label' => esc_html__( 'Tabs Rotation Interval', 'fusion-builder' ),
'description' => esc_html__( 'Controls how long each tab stays active when "Auto Rotate Tabs" is enabled on the element, in milliseconds.', 'fusion-builder' ),
'id' => 'tabs_autoplay_speed',
'default' => '5000',
'type' => 'slider',
'choices' => [
'min' => '1000',
'max' => '20000',
'step' => '500',
],
],
'tabs_autoplay_indicator_color' => [
'label' => esc_html__( 'Tabs Rotation Indicator Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the rotation progress indicator. Leave empty to use the active tab border color.', 'fusion-builder' ),
'id' => 'tabs_autoplay_indicator_color',
'default' => '',
'type' => 'color-alpha',
],
'tabs_autoplay_indicator_size' => [
'label' => esc_html__( 'Tabs Rotation Indicator Size', 'fusion-builder' ),
'description' => esc_html__( 'Set the thickness of the rotation progress indicator, in pixels. Only used by the classic design.', 'fusion-builder' ),
'id' => 'tabs_autoplay_indicator_size',
'default' => '3',
'type' => 'slider',
'choices' => [
'min' => '1',
'max' => '10',
'step' => '1',
],
],
'tabs_mobile_breakpoint' => [
'label' => esc_html__( 'Tabs Mobile Breakpoint', 'fusion-builder' ),
'description' => esc_html__( 'Choose when the tabs will switch to mobile mode.', 'fusion-builder' ),
'id' => 'tabs_mobile_breakpoint',
'default' => 'medium',
'type' => 'radio-buttonset',
'transport' => 'postMessage',
'choices' => [
'medium' => esc_attr__( 'Medium', 'fusion-builder' ),
'small' => esc_attr__( 'Small', 'fusion-builder' ),
],
],
'tabs_mobile_mode' => [
'label' => esc_html__( 'Tabs Mobile Mode', 'fusion-builder' ),
'description' => esc_html__( 'Choose the tabs mode for mobile devices. Carousel will be come active only, if tabs don\'t fit the device screen width.', 'fusion-builder' ),
'id' => 'tabs_mobile_mode',
'default' => 'accordion',
'type' => 'radio-buttonset',
'transport' => 'postMessage',
'choices' => [
'accordion' => esc_attr__( 'Accordion', 'fusion-builder' ),
'toggle' => esc_attr__( 'Toggle', 'fusion-builder' ),
'carousel' => esc_attr__( 'Carousel', 'fusion-builder' ),
],
],
'tabs_mobile_sticky_tabs' => [
'label' => esc_html__( 'Mobile Sticky Tabs', 'fusion-builder' ),
'description' => esc_html__( 'Set tabs to sticky for carousel mode on mobile, useful for long content.', 'fusion-builder' ),
'id' => 'tabs_mobile_sticky_tabs',
'default' => 'no',
'type' => 'radio-buttonset',
'transport' => 'postMessage',
'choices' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
],
],
],
];
}
/**
* Get the style variables.
*
* @access protected
* @since 3.9
* @return string
*/
protected function get_style_variables() {
$this->args = $this->parent_args;
// Todo: set $this->defaults.
$css_vars_options = [
'margin_top' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_bottom' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_top_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_right_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_bottom_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_left_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_top_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_right_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_bottom_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'margin_left_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_border_radius_top_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_border_radius_top_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_border_radius_bottom_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_border_radius_bottom_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_border_radius_top_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_border_radius_top_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_border_radius_bottom_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_border_radius_bottom_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_top' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_bottom' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_top_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_right_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_bottom_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_left_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_top_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_right_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_bottom_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_padding_left_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_height' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_height_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'content_height_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_top' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_right' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_bottom' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_left' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_top_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_right_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_bottom_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_left_medium' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_top_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_right_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_bottom_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_padding_left_small' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_font_size' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'title_text_transform',
'title_line_height',
'title_letter_spacing' => [ 'callback' => [ 'Fusion_Sanitize', 'get_value_with_unit' ] ],
'alignment',
];
$custom_vars = [];
if ( $this->parent_args['inactivecolor'] ) {
$custom_vars['inactive_color'] = $this->parent_args['inactivecolor'];
}
if ( $this->parent_args['title_text_color'] ) {
$custom_vars['title_text_color'] = $this->parent_args['title_text_color'];
}
if ( $this->parent_args['title_active_text_color'] ) {
$custom_vars['title_active_text_color'] = $this->parent_args['title_active_text_color'];
}
$custom_vars['background_color'] = $this->parent_args['backgroundcolor'];
$custom_vars['border_color'] = $this->parent_args['bordercolor'];
$custom_vars['active_border_color'] = $this->parent_args['active_border_color'];
if ( '' !== $this->parent_args['active_border_size'] ) {
$custom_vars['active_border_size'] = fusion_library()->sanitize->get_value_with_unit( $this->parent_args['active_border_size'] );
}
// Left unset when empty, so the LESS keeps its per layout default.
if ( '' !== $this->parent_args['title_alignment'] ) {
$custom_vars['title_alignment'] = $this->parent_args['title_alignment'];
// With the icon above the title there is nothing to space apart on that axis.
$custom_vars['title_alignment_block'] = 'space-between' === $this->parent_args['title_alignment'] ? 'center' : $this->parent_args['title_alignment'];
}
if ( '' !== $this->parent_args['title_min_width'] ) {
$custom_vars['title_min_width'] = fusion_library()->sanitize->get_value_with_unit( $this->parent_args['title_min_width'] );
}
if ( '' !== $this->parent_args['description_font_size'] ) {
$custom_vars['description_font_size'] = fusion_library()->sanitize->get_value_with_unit( $this->parent_args['description_font_size'] );
}
if ( '' !== $this->parent_args['description_color'] ) {
$custom_vars['description_color'] = $this->parent_args['description_color'];
}
// Left unset when empty, so the LESS keeps its per design fallback.
if ( '' !== $this->parent_args['content_background_color'] ) {
$custom_vars['content_background_color'] = $this->parent_args['content_background_color'];
}
// Only emitted once the gradient has colors, so the LESS keeps its
// own 'none' and the flat colors are left untouched.
if ( 'yes' === $this->parent_args['title_gradient'] ) {
$title_gradient = $this->get_gradient_value( 'title_' );
if ( '' !== $title_gradient ) {
$custom_vars['title_bg_image'] = $title_gradient;
}
// Left unset when the active state has no colors of its own, so
// the LESS falls back to the regular gradient above.
$active_gradient = $this->get_gradient_value( 'title_', 'active' );
if ( '' !== $active_gradient ) {
$custom_vars['title_active_bg_image'] = $active_gradient;
}
// The classic accent edge would otherwise cut a flat stripe across the gradient on hover.
if ( '' !== $title_gradient || '' !== $active_gradient ) {
$custom_vars['title_hover_border_color'] = 'var(--awb-inactive-color)';
}
}
if ( 'none' !== $this->get_content_transition() ) {
$custom_vars['transition_speed'] = (int) $this->parent_args['content_transition_speed'] . 'ms';
}
if ( 'off' !== $this->get_autoplay_mode() ) {
$custom_vars['autoplay_speed'] = (int) $this->parent_args['autoplay_speed'] . 'ms';
if ( '' !== $this->parent_args['autoplay_indicator_size'] ) {
$custom_vars['autoplay_indicator_size'] = fusion_library()->sanitize->get_value_with_unit( $this->parent_args['autoplay_indicator_size'] );
}
// Left unset when empty, so the LESS falls back to the active border color.
if ( '' !== $this->parent_args['autoplay_indicator_color'] ) {
$custom_vars['autoplay_indicator_color'] = $this->parent_args['autoplay_indicator_color'];
// The LESS tones the indicator down only because it otherwise
// borrows the active border color. A deliberate color is used as given.
$custom_vars['autoplay_indicator_opacity'] = 1;
if ( 'classic' === $this->parent_args['design'] ) {
$custom_vars['autoplay_track_color'] = 'var(--awb-active-border-color)';
}
}
// A deliberate track color wins over the classic fallback above.
if ( '' !== $this->parent_args['autoplay_track_color'] ) {
$custom_vars['autoplay_track_color'] = $this->parent_args['autoplay_track_color'];
}
// Left unset when empty, so the button keeps following the tab title colors.
if ( '' !== $this->parent_args['autoplay_pause_button_color'] ) {
$custom_vars['autoplay_toggle_color'] = $this->parent_args['autoplay_pause_button_color'];
}
}
// Each side is left unset when empty, so the LESS keeps its own per
// design default for that side and nothing is emitted for the
// overwhelming majority of elements.
if ( 'clean' === $this->parent_args['design'] ) {
foreach ( [ 'title_border_size', 'content_border_size' ] as $prefix ) {
foreach ( [ 'top', 'right', 'bottom', 'left' ] as $side ) {
$value = $this->parent_args[ $prefix . '_' . $side ];
if ( '' !== $value ) {
$custom_vars[ $prefix . '_' . $side ] = fusion_library()->sanitize->get_value_with_unit( $value );
}
}
}
} elseif ( '' !== $this->parent_args['border_size'] ) {
$custom_vars['border_size'] = fusion_library()->sanitize->get_value_with_unit( $this->parent_args['border_size'] );
}
$styles = $this->get_css_vars_for_options( $css_vars_options ) . $this->get_custom_css_vars( $custom_vars ) . $this->get_font_styling_vars( 'title_font' );
return $styles;
}
/**
* Load base CSS.
*
* @access public
* @since 3.0
* @return void
*/
public function add_css_files() {
self::register_css_files();
}
/**
* Sets the necessary scripts.
*
* @access public
* @since 3.2
* @return void
*/
public function on_first_render() {
awb_register_tabs_js_files();
}
public static function register_css_files() {
awb_register_tabs_css_files();
}
}
}
new FusionSC_Tabs();
}
/**
* Registers the Tabs element JS files.
* Defined outside the element class so it is available even when the Tabs element is disabled.
*
* @since 3.15.3
* @return void
*/
function awb_register_tabs_js_files() {
$fusion_settings = awb_get_fusion_settings();
Fusion_Dynamic_JS::enqueue_script(
'fusion-tabs',
FusionBuilder::$js_folder_url . '/general/fusion-tabs.js',
FusionBuilder::$js_folder_path . '/general/fusion-tabs.js',
[ 'modernizr', 'awb-tab' ],
FUSION_BUILDER_VERSION,
true
);
// Where the tabs switch to their mobile mode, and where auto rotation flips
// between its desktop and mobile setting.
$tabs_break_point = ( 'small' === $fusion_settings->get( 'tabs_mobile_breakpoint' ) )
? intval( $fusion_settings->get( 'visibility_small' ) )
: intval( $fusion_settings->get( 'visibility_medium' ) );
Fusion_Dynamic_JS::localize_script(
'fusion-tabs',
'fusionTabVars',
[
'content_break_point' => intval( $fusion_settings->get( 'content_break_point' ) ),
'tabs_break_point' => $tabs_break_point,
]
);
}
/**
* Registers the Tabs element CSS files.
* Defined outside the element class so it is available even when the Tabs element is disabled.
*
* @since 3.15.3
* @return void
*/
function awb_register_tabs_css_files() {
$fusion_settings = awb_get_fusion_settings();
$breakpoint = $fusion_settings->get( 'tabs_mobile_breakpoint' );
FusionBuilder()->add_element_css( FUSION_BUILDER_PLUGIN_DIR . 'assets/css/shortcodes/tabs.min.css' );
if ( class_exists( 'Avada' ) ) {
$version = Avada::get_theme_version();
Fusion_Media_Query_Scripts::$media_query_assets[] = [
'avada-tabs-lg-min',
FUSION_BUILDER_PLUGIN_DIR . 'assets/css/media/tabs-lg-min.min.css',
[],
$version,
Fusion_Media_Query_Scripts::get_media_query_from_key( 'fusion-min-' . $breakpoint ),
];
Fusion_Media_Query_Scripts::$media_query_assets[] = [
'avada-tabs-lg-max',
FUSION_BUILDER_PLUGIN_DIR . 'assets/css/media/tabs-lg-max.min.css',
[],
$version,
Fusion_Media_Query_Scripts::get_media_query_from_key( 'fusion-max-' . $breakpoint ),
];
Fusion_Media_Query_Scripts::$media_query_assets[] = [
'avada-tabs-md',
FUSION_BUILDER_PLUGIN_DIR . 'assets/css/media/tabs-md.min.css',
[],
$version,
Fusion_Media_Query_Scripts::get_media_query_from_key( 'fusion-max-medium' ),
];
Fusion_Media_Query_Scripts::$media_query_assets[] = [
'avada-tabs-sm',
FUSION_BUILDER_PLUGIN_DIR . 'assets/css/media/tabs-sm.min.css',
[],
$version,
Fusion_Media_Query_Scripts::get_media_query_from_key( 'fusion-max-small' ),
];
}
}
/**
* Map shortcode to Avada Builder.
*
* @since 1.0
*/
function fusion_element_tabs() {
$fusion_settings = awb_get_fusion_settings();
$is_builder = ( function_exists( 'fusion_is_preview_frame' ) && fusion_is_preview_frame() ) || ( function_exists( 'fusion_is_builder_frame' ) && fusion_is_builder_frame() );
$to_link = '';
if ( $is_builder ) {
$to_link = '<span class="fusion-panel-shortcut" data-fusion-option="tabs_mobile_breakpoint">' . esc_html__( 'Global Options', 'fusion-builder' ) . '</span>';
} else {
$to_link = '<a href="' . esc_url( $fusion_settings->get_setting_link( 'tabs_mobile_breakpoint' ) ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Global Options', 'fusion-builder' ) . '</a>';
}
fusion_builder_map(
fusion_builder_frontend_data(
'FusionSC_Tabs',
[
'name' => esc_attr__( 'Tabs', 'fusion-builder' ),
'shortcode' => 'fusion_tabs',
'multi' => 'multi_element_parent',
'element_child' => 'fusion_tab',
'icon' => 'fusiona-folder',
'preview' => FUSION_BUILDER_PLUGIN_DIR . 'inc/templates/previews/fusion-tabs-preview.php',
'preview_id' => 'fusion-builder-block-module-tabs-preview-template',
'child_ui' => true,
'help_url' => 'https://classic.avada.com/documentation/tabs-element/',
'sortable' => false,
'subparam_map' => [
'fusion_font_family_title_font' => 'title_typography',
'fusion_font_variant_title_font' => 'title_typography',
'title_font_size' => 'title_typography',
'title_line_height' => 'title_typography',
'title_letter_spacing' => 'title_typography',
'title_text_transform' => 'title_typography',
],
'params' => [
[
'type' => 'textfield',
'heading' => esc_attr__( 'Dynamic Data', 'fusion-builder' ),
'param_name' => 'parent_dynamic_content',
'dynamic_data' => true,
'dynamic_options' => [ 'acf_repeater_parent' ],
'group' => esc_attr__( 'children', 'fusion-builder' ),
],
[
'type' => 'tinymce',
'heading' => esc_attr__( 'Content', 'fusion-builder' ),
'description' => esc_attr__( 'Enter some content for this tabs element.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => '[fusion_tab title="' . esc_attr__( 'Your Content Goes Here', 'fusion-builder' ) . '" icon=""]' . esc_attr__( 'Your Content Goes Here', 'fusion-builder' ) . '[/fusion_tab]',
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Design', 'fusion-builder' ),
'description' => esc_attr__( 'Choose a design for the element.', 'fusion-builder' ),
'param_name' => 'design',
'value' => [
'classic' => esc_attr__( 'Classic', 'fusion-builder' ),
'clean' => esc_attr__( 'Clean', 'fusion-builder' ),
],
'default' => 'classic',
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Layout', 'fusion-builder' ),
'description' => esc_attr__( 'Choose the layout of the element.' ),
'param_name' => 'layout',
'value' => [
'horizontal' => esc_attr__( 'Horizontal', 'fusion-builder' ),
'vertical' => esc_attr__( 'Vertical', 'fusion-builder' ),
],
'default' => 'horizontal',
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Justify Tabs', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to get tabs stretched over full element width.', 'fusion-builder' ),
'param_name' => 'justified',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'yes',
'dependency' => [
[
'element' => 'layout',
'value' => 'horizontal',
'operator' => '==',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Tabs Alignment', 'fusion-builder' ),
'description' => esc_attr__( 'Choose tabs alignment.', 'fusion-builder' ),
'param_name' => 'alignment',
'default' => 'start',
'grid_layout' => true,
'back_icons' => true,
'icons' => [
'start' => '<span class="fusiona-horizontal-flex-start"></span>',
'center' => '<span class="fusiona-horizontal-flex-center"></span>',
'end' => '<span class="fusiona-horizontal-flex-end"></span>',
],
'value' => [
// We use "start/end" terminology because flex direction changes depending on RTL/LTR.
'start' => esc_html__( 'Start', 'fusion-builder' ),
'center' => esc_html__( 'Center', 'fusion-builder' ),
'end' => esc_html__( 'End', 'fusion-builder' ),
],
'dependency' => [
[
'element' => 'layout',
'value' => 'horizontal',
'operator' => '==',
],
[
'element' => 'justified',
'value' => 'no',
'operator' => '==',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Tab Title Alignment', 'fusion-builder' ),
'description' => esc_attr__( 'Choose how the icon and title are aligned within each tab. "Space Between" pushes them to opposite edges. Leave on "Default" for centered titles on horizontal tabs and start aligned ones on vertical tabs. Most useful together with a minimum tab width, or with justified tabs.', 'fusion-builder' ),
'param_name' => 'title_alignment',
'default' => '',
'grid_layout' => true,
'back_icons' => true,
'icons' => [
'' => '<span class="fusiona-cog"></span>',
'start' => '<span class="fusiona-horizontal-flex-start"></span>',
'center' => '<span class="fusiona-horizontal-flex-center"></span>',
'end' => '<span class="fusiona-horizontal-flex-end"></span>',
'space-between' => '<span class="fusiona-horizontal-space-between"></span>',
],
'value' => [
'' => esc_attr__( 'Default', 'fusion-builder' ),
'start' => esc_attr__( 'Start', 'fusion-builder' ),
'center' => esc_attr__( 'Center', 'fusion-builder' ),
'end' => esc_attr__( 'End', 'fusion-builder' ),
'space-between' => esc_attr__( 'Space Between', 'fusion-builder' ),
],
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'Tab Minimum Width', 'fusion-builder' ),
'description' => esc_attr__( 'Set a minimum width for each tab, so tabs with short titles do not end up narrower than the rest. Tabs still grow past it when the title needs more room. Only applies above the tabs mobile breakpoint. Enter value with unit, ex: 200px. Percentages are not supported. Leave empty to disable.', 'fusion-builder' ),
'param_name' => 'title_min_width',
'value' => '',
// Hidden for justified horizontal tabs, which already share the full width.
// Vertical never justifies but keeps the stored value, hence the OR.
'or' => true,
'dependency' => [
[
'element' => 'justified',
'value' => 'yes',
'operator' => '!=',
],
[
'element' => 'layout',
'value' => 'horizontal',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Sticky Tabs', 'fusion-builder' ),
'description' => esc_attr__( 'Turn on to have the tabs navigation stick on scroll. Useful for long content.', 'fusion-builder' ),
'param_name' => 'sticky_tabs',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'no',
'dependency' => [
[
'element' => 'layout',
'value' => 'horizontal',
'operator' => '==',
],
],
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'Sticky Tabs Offset', 'fusion-builder' ),
'description' => esc_attr__( 'Controls how far the top of the column is offset from top of viewport when sticky. Use either a unit of measurement, or a CSS selector.', 'fusion-builder' ),
'param_name' => 'sticky_tabs_offset',
'value' => '',
'dependency' => [
[
'element' => 'layout',
'value' => 'horizontal',
'operator' => '==',
],
[
'element' => 'sticky_tabs',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Update URL On Tab Change', 'fusion-builder' ),
'description' => esc_attr__( 'Write the selected tab into the page address, so a visitor can copy a link that opens on that tab. The address is replaced rather than added to the browser history, so the back button still leaves the page.', 'fusion-builder' ),
'param_name' => 'update_url',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'no',
],
[
'type' => 'select',
'heading' => esc_attr__( 'Content Transition', 'fusion-builder' ),
'description' => esc_attr__( 'Choose how the tab content changes when a different tab is selected. The outgoing content finishes before the incoming one starts, so the two never overlap.', 'fusion-builder' ),
'param_name' => 'content_transition',
'default' => 'fade',
'value' => [
'none' => esc_attr__( 'None', 'fusion-builder' ),
'fade' => esc_attr__( 'Fade', 'fusion-builder' ),
'slide' => esc_attr__( 'Slide', 'fusion-builder' ),
'zoom' => esc_attr__( 'Zoom', 'fusion-builder' ),
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Transition Direction', 'fusion-builder' ),
'description' => esc_attr__( 'Choose which way the incoming content travels, so "Up" means it rises into place from below.', 'fusion-builder' ),
'param_name' => 'content_transition_direction',
'default' => 'up',
'value' => [
'up' => esc_attr__( 'Up', 'fusion-builder' ),
'down' => esc_attr__( 'Down', 'fusion-builder' ),
'left' => esc_attr__( 'Left', 'fusion-builder' ),
'right' => esc_attr__( 'Right', 'fusion-builder' ),
],
'dependency' => [
[
'element' => 'content_transition',
'value' => 'slide',
'operator' => '==',
],
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Transition Speed', 'fusion-builder' ),
'description' => esc_attr__( 'Controls how long the transition takes, in milliseconds. It applies to the outgoing and the incoming content separately, so the full swap takes twice this.', 'fusion-builder' ),
'param_name' => 'content_transition_speed',
'default' => '300',
'min' => '50',
'max' => '1500',
'step' => '50',
'dependency' => [
[
'element' => 'content_transition',
'value' => 'none',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Auto Rotate Tabs', 'fusion-builder' ),
'description' => esc_attr__( 'Automatically switch to the next tab after a set interval, and choose where that happens. On mobile it carries over to whichever mobile mode is set. Rotation starts once the element scrolls into view, pauses on hover and keyboard focus, and is switched off for visitors who prefer reduced motion.', 'fusion-builder' ),
'param_name' => 'autoplay',
'value' => [
'off' => esc_attr__( 'Off', 'fusion-builder' ),
'desktop' => esc_attr__( 'Desktop', 'fusion-builder' ),
'mobile' => esc_attr__( 'Mobile', 'fusion-builder' ),
'both' => esc_attr__( 'Both', 'fusion-builder' ),
],
'default' => 'off',
],
[
'type' => 'range',
'heading' => esc_attr__( 'Rotation Interval', 'fusion-builder' ),
'description' => esc_attr__( 'Controls how long each tab stays active, in milliseconds. If the tab contents differ a lot in height, set a "Content Height" on the design tab to stop the page from jumping on each switch.', 'fusion-builder' ),
'param_name' => 'autoplay_speed',
'value' => '',
'default' => $fusion_settings->get( 'tabs_autoplay_speed' ),
'min' => '1000',
'max' => '20000',
'step' => '500',
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Pause On Hover', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to pause the rotation while the mouse is over the element. Rotation always pauses while a tab has keyboard focus.', 'fusion-builder' ),
'param_name' => 'autoplay_pause_on_hover',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'yes',
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Resume After Interaction', 'fusion-builder' ),
'description' => esc_attr__( 'Choose whether rotation continues after a visitor selects a tab themselves. When set to no, rotation stops for good on the first interaction.', 'fusion-builder' ),
'param_name' => 'autoplay_resume',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'no',
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Play / Pause Button', 'fusion-builder' ),
'description' => esc_attr__( 'Show a play / pause button above the tabs, so visitors can stop the rotation. Recommended as accessibility aid.', 'fusion-builder' ),
'param_name' => 'autoplay_pause_button',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'no',
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
],
],
[
'type' => 'iconpicker',
'heading' => esc_attr__( 'Icon', 'fusion-builder' ),
'param_name' => 'icon',
'value' => '',
'description' => esc_attr__( 'Global setting for all tabs, this can be overridden individually. Click an icon to select, click again to deselect.', 'fusion-builder' ),
],
[
'heading' => esc_html__( 'Icon Position', 'fusion-builder' ),
'description' => esc_html__( 'Choose the position of the icon on the tab. Icons can be selected in the general tab for the same icon on all tabs, or in each child item for individual tab icons.', 'fusion-builder' ),
'param_name' => 'icon_position',
'default' => '',
'type' => 'radio_button_set',
'value' => [
'' => esc_attr__( 'Default', 'fusion-builder' ),
'left' => esc_attr__( 'Left', 'fusion-builder' ),
'right' => esc_attr__( 'Right', 'fusion-builder' ),
'top' => esc_attr__( 'Top', 'fusion-builder' ),
],
],
[
'heading' => esc_html__( 'Tabs Icon Size', 'fusion-builder' ),
'description' => esc_html__( 'Set the size of the icon. In pixels, ex: 13px. Icons can be selected in the general tab for the same icon on all tabs, or in each child item for individual tab icons.', 'fusion-builder' ),
'param_name' => 'icon_size',
'default' => $fusion_settings->get( 'tabs_icon_size' ),
'min' => '1',
'max' => '150',
'step' => '1',
'type' => 'range',
],
[
'type' => 'checkbox_button_set',
'heading' => esc_attr__( 'Element Visibility', 'fusion-builder' ),
'param_name' => 'hide_on_mobile',
'value' => fusion_builder_visibility_options( 'full' ),
'default' => fusion_builder_default_visibility( 'array' ),
'description' => esc_attr__( 'Choose to show or hide the element on small, medium or large screens. You can choose more than one at a time.', 'fusion-builder' ),
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'CSS Class', 'fusion-builder' ),
'description' => esc_attr__( 'Add a class to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'class',
'value' => '',
'group' => esc_attr__( 'General', 'fusion-builder' ),
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'CSS ID', 'fusion-builder' ),
'description' => esc_attr__( 'Add an ID to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'id',
'value' => '',
'group' => esc_attr__( 'General', 'fusion-builder' ),
],
// Design Tab.
'fusion_margin_placeholder' => [
'param_name' => 'margin',
'value' => [
'margin_top' => '',
'margin_right' => '',
'margin_bottom' => '',
'margin_left' => '',
],
'responsive' => [
'state' => 'large',
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Tabs Title Tag', 'fusion-builder' ),
'description' => esc_attr__( 'Choose HTML tag of the tabs title, either div or the heading tag, h1-h6.', 'fusion-builder' ),
'param_name' => 'title_tag',
'value' => [
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'div' => 'DIV',
],
'default' => 'h4',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'typography',
'remove_from_atts' => true,
'global' => true,
'heading' => esc_attr__( 'Tabs Title Typography', 'fusion-builder' ),
'description' => esc_html__( 'Controls the tabs title text typography.', 'fusion-builder' ),
'param_name' => 'title_typography',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'choices' => [
'font-family' => 'title_font',
'font-size' => 'title_font_size',
'line-height' => 'title_line_height',
'letter-spacing' => 'title_letter_spacing',
'text-transform' => 'title_text_transform',
],
'default' => [
'font-family' => '',
'variant' => '',
'font-size' => '',
'line-height' => '',
'letter-spacing' => '',
'text-transform' => '',
],
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Tabs Title Color', 'fusion-builder' ),
'description' => esc_html__( 'Controls the color of the tabs title.', 'fusion-builder' ),
'param_name' => 'title_text_color',
'default' => $fusion_settings->get( 'tabs_title_color' ),
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'title_active_text_color',
'default' => $fusion_settings->get( 'tabs_active_title_color' ),
],
],
'connect-state' => [ 'inactivecolor', 'icon_color', 'backgroundcolor', 'icon_active_color' ],
],
[
'heading' => esc_html__( 'Icon Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of the icon.', 'fusion-builder' ),
'param_name' => 'icon_color',
'default' => $fusion_settings->get( 'tabs_icon_color' ),
'type' => 'colorpickeralpha',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'icon_active_color',
'default' => $fusion_settings->get( 'tabs_icon_active_color' ),
],
],
'connect-state' => [ 'inactivecolor', 'title_text_color', 'backgroundcolor', 'title_active_text_color' ],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Tabs Title Padding', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the padding of tabs title, In pixels or percentage, ex: 10px or 10%.', 'fusion-builder' ),
'param_name' => 'title_padding',
'value' => [
'title_padding_top' => '',
'title_padding_right' => '',
'title_padding_bottom' => '',
'title_padding_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'responsive' => [
'state' => 'large',
],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Tabs Title Border Size', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the thickness of the border around each tab. In pixels or em, ex: 1px. Leave empty for the default of 1px, or set 0 to remove a side.', 'fusion-builder' ),
'param_name' => 'title_border_size',
'value' => [
'title_border_size_top' => '',
'title_border_size_right' => '',
'title_border_size_bottom' => '',
'title_border_size_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'design',
'value' => 'clean',
'operator' => '==',
],
],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Tabs Title Border Radius', 'fusion-builder' ),
'description' => __( 'Controls the border radius of tabs title, In pixels or percentage, ex: 10px or 10%. The content panel keeps its own border, which can sit oddly against rounded tabs; set Border Color to transparent to drop it.', 'fusion-builder' ),
'param_name' => 'title_border_radius',
'value' => [
'title_border_radius_top_left' => '',
'title_border_radius_top_right' => '',
'title_border_radius_bottom_right' => '',
'title_border_radius_bottom_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Tabs Title Background Color', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the background inactive tab color. ', 'fusion-builder' ),
'param_name' => 'inactivecolor',
'value' => '',
'default' => $fusion_settings->get( 'tabs_inactive_color' ),
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'backgroundcolor',
'default' => $fusion_settings->get( 'tabs_bg_color' ),
],
],
'connect-state' => [ 'title_text_color', 'icon_color', 'title_active_text_color', 'icon_active_color', 'title_gradient_start_color', 'title_active_gradient_start_color', 'title_gradient_end_color', 'title_active_gradient_end_color' ],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Tabs Background Gradient', 'fusion-builder' ),
'description' => esc_attr__( 'Set to "Yes" to fill the tabs with a gradient. It is painted over the background color above, so a gradient using transparency blends into that color.', 'fusion-builder' ),
'param_name' => 'title_gradient',
'default' => 'no',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Tabs Gradient Start Color', 'fusion-builder' ),
'description' => esc_attr__( 'Select start color for the tab gradient. Leave the active state empty to use the same gradient on every tab.', 'fusion-builder' ),
'param_name' => 'title_gradient_start_color',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'title_active_gradient_start_color',
'default' => '',
],
],
'connect-state' => [ 'title_gradient_end_color', 'title_active_gradient_end_color', 'inactivecolor', 'backgroundcolor', 'title_text_color', 'title_active_text_color', 'icon_color', 'icon_active_color' ],
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Tabs Gradient End Color', 'fusion-builder' ),
'description' => esc_attr__( 'Select end color for the tab gradient. Leave the active state empty to use the same gradient on every tab.', 'fusion-builder' ),
'param_name' => 'title_gradient_end_color',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'title_active_gradient_end_color',
'default' => '',
],
],
'connect-state' => [ 'title_gradient_start_color', 'title_active_gradient_start_color', 'inactivecolor', 'backgroundcolor', 'title_text_color', 'title_active_text_color', 'icon_color', 'icon_active_color' ],
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Tabs Gradient Start Position', 'fusion-builder' ),
'description' => esc_attr__( 'Select start position for the tab gradient.', 'fusion-builder' ),
'param_name' => 'title_gradient_start_position',
'value' => '0',
'min' => '0',
'max' => '100',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Tabs Gradient End Position', 'fusion-builder' ),
'description' => esc_attr__( 'Select end position for the tab gradient.', 'fusion-builder' ),
'param_name' => 'title_gradient_end_position',
'value' => '100',
'min' => '0',
'max' => '100',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Tabs Gradient Type', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the tab gradient type.', 'fusion-builder' ),
'param_name' => 'title_gradient_type',
'default' => 'linear',
'value' => [
'linear' => esc_attr__( 'Linear', 'fusion-builder' ),
'radial' => esc_attr__( 'Radial', 'fusion-builder' ),
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'select',
'heading' => esc_attr__( 'Tabs Radial Direction', 'fusion-builder' ),
'description' => esc_attr__( 'Select direction for the radial tab gradient.', 'fusion-builder' ),
'param_name' => 'title_radial_direction',
'default' => 'center center',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'value' => [
'left top' => esc_attr__( 'Left Top', 'fusion-builder' ),
'left center' => esc_attr__( 'Left Center', 'fusion-builder' ),
'left bottom' => esc_attr__( 'Left Bottom', 'fusion-builder' ),
'right top' => esc_attr__( 'Right Top', 'fusion-builder' ),
'right center' => esc_attr__( 'Right Center', 'fusion-builder' ),
'right bottom' => esc_attr__( 'Right Bottom', 'fusion-builder' ),
'center top' => esc_attr__( 'Center Top', 'fusion-builder' ),
'center center' => esc_attr__( 'Center Center', 'fusion-builder' ),
'center bottom' => esc_attr__( 'Center Bottom', 'fusion-builder' ),
],
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
[
'element' => 'title_gradient_type',
'value' => 'radial',
'operator' => '==',
],
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Tabs Gradient Angle', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the tab gradient angle. In degrees.', 'fusion-builder' ),
'param_name' => 'title_linear_angle',
'value' => '180',
'min' => '0',
'max' => '360',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'title_gradient',
'value' => 'yes',
'operator' => '==',
],
[
'element' => 'title_gradient_type',
'value' => 'linear',
'operator' => '==',
],
],
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'Tab Description Font Size', 'fusion-builder' ),
'description' => esc_attr__( 'Set the font size of the tab descriptions. Enter value with unit, ex: 14px. Leave empty to use a size relative to the tab title.', 'fusion-builder' ),
'param_name' => 'description_font_size',
'value' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Tab Description Color', 'fusion-builder' ),
'description' => esc_html__( 'Controls the color of the tab descriptions. Leave empty to use the active tab title color.', 'fusion-builder' ),
'param_name' => 'description_color',
'value' => '',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'Content Height', 'fusion-builder' ),
'description' => esc_attr__( 'Set a fixed height for the tab content area. When the content exceeds this height, a scrollbar will appear. Leave empty to disable. Enter value with unit, ex: 400px.', 'fusion-builder' ),
'param_name' => 'content_height',
'value' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'responsive' => [
'state' => 'large',
],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Tabs Content Padding', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the padding of tabs content, In pixels or percentage, ex: 10px or 10%.', 'fusion-builder' ),
'param_name' => 'content_padding',
'value' => [
'content_padding_top' => '',
'content_padding_right' => '',
'content_padding_bottom' => '',
'content_padding_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'responsive' => [
'state' => 'large',
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Border Size', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the thickness of the border around the tab list and the content panel, in pixels. The two are one continuous frame on this design, so a single size keeps them aligned. Set to 0 to remove the border.', 'fusion-builder' ),
'param_name' => 'border_size',
'value' => '',
'default' => '1',
'min' => '0',
'max' => '20',
'step' => '1',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'design',
'value' => 'classic',
'operator' => '==',
],
],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Content Border Size', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the thickness of the border around the content panel. In pixels or em, ex: 1px. This design draws no panel border by default, so anything above 0 adds one. Pairs with the content background color and border radius.', 'fusion-builder' ),
'param_name' => 'content_border_size',
'value' => [
'content_border_size_top' => '',
'content_border_size_right' => '',
'content_border_size_bottom' => '',
'content_border_size_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'design',
'value' => 'clean',
'operator' => '==',
],
],
],
[
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Content Border Radius', 'fusion-builder' ),
'description' => __( 'Controls the border radius of the content panel, in pixels or percentage, ex: 10px or 10%. On the classic design the active tab runs into the top edge of the panel, so rounding only the bottom corners usually reads best there.', 'fusion-builder' ),
'param_name' => 'content_border_radius',
'value' => [
'content_border_radius_top_left' => '',
'content_border_radius_top_right' => '',
'content_border_radius_bottom_right' => '',
'content_border_radius_bottom_left' => '',
],
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Content Background Color', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the background color of the content panel. Leave empty for the default, which is the active tab background color on the classic design, so that panel and active tab read as one surface, and no color at all on the clean design.', 'fusion-builder' ),
'param_name' => 'content_background_color',
'value' => '',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Border Color', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the color of the border around the tab list and the content panel. Set it to transparent to remove those borders, which is often what rounded tabs want.', 'fusion-builder' ),
'param_name' => 'bordercolor',
'value' => '',
'default' => $fusion_settings->get( 'tabs_border_color' ),
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Active Tab Accent Border Color', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the color of the accent edge on the active tab, which only the classic design draws. The rotation progress indicator falls back to it when no color of its own is set.', 'fusion-builder' ),
'param_name' => 'active_border_color',
'value' => '',
'default' => $fusion_settings->get( 'primary_color' ),
'group' => esc_attr__( 'Design', 'fusion-builder' ),
],
[
'type' => 'range',
'heading' => esc_attr__( 'Active Tab Accent Border Size', 'fusion-builder' ),
'description' => esc_attr__( 'Controls the thickness of the accent border on the active tab, in pixels. When auto rotation is enabled, the progress line is drawn along that same border.', 'fusion-builder' ),
'param_name' => 'active_border_size',
'value' => '',
'default' => $fusion_settings->get( 'tabs_active_border_size' ),
'min' => '0',
'max' => '20',
'step' => '1',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'design',
'value' => 'classic',
'operator' => '==',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Rotation Progress Indicator', 'fusion-builder' ),
'description' => esc_attr__( 'Show a progress indicator on the active tab that fills up before the next tab is shown. The classic design uses a bar on the active tab accent edge, the clean design fills the tab itself.', 'fusion-builder' ),
'param_name' => 'autoplay_indicator',
'value' => [
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'default' => 'yes',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
],
],
[
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Rotation Progress Indicator Style', 'fusion-builder' ),
'description' => esc_attr__( 'Choose whether the progress fills the background of the active tab, or draws a line along its edge. Default uses a line on the classic design, drawn over the accent edge it already has, and a background fill on the clean design.', 'fusion-builder' ),
'param_name' => 'autoplay_indicator_style',
'value' => [
'' => esc_attr__( 'Default', 'fusion-builder' ),
'background' => esc_attr__( 'Background', 'fusion-builder' ),
'line' => esc_attr__( 'Line', 'fusion-builder' ),
],
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_indicator',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'select',
'heading' => esc_attr__( 'Rotation Progress Line Position', 'fusion-builder' ),
'description' => esc_attr__( 'Choose which edge of the active tab the progress line runs along. Any edge can be used on either tab layout. Default uses the start edge for vertical tabs and the bottom edge for horizontal ones.', 'fusion-builder' ),
'param_name' => 'autoplay_indicator_position',
'value' => [
// "Start/end" rather than left/right, as the leading edge flips with RTL.
'' => esc_attr__( 'Default', 'fusion-builder' ),
'top' => esc_attr__( 'Horizontal - Top', 'fusion-builder' ),
'bottom' => esc_attr__( 'Horizontal - Bottom', 'fusion-builder' ),
'start' => esc_attr__( 'Vertical - Start', 'fusion-builder' ),
'end' => esc_attr__( 'Vertical - End', 'fusion-builder' ),
],
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_indicator',
'value' => 'yes',
'operator' => '==',
],
[
'element' => 'design',
'value' => 'clean',
'operator' => '==',
],
[
'element' => 'autoplay_indicator_style',
'value' => 'line',
'operator' => '==',
],
],
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Rotation Progress Indicator Color', 'fusion-builder' ),
'description' => esc_attr__( 'Set the color of the rotation progress indicator. Leave empty to derive it from the active tab border color, softened so the progress stays readable against it.', 'fusion-builder' ),
'param_name' => 'autoplay_indicator_color',
'value' => '',
'default' => $fusion_settings->get( 'tabs_autoplay_indicator_color' ),
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_indicator',
'value' => 'yes',
'operator' => '==',
],
],
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Rotation Progress Track Color', 'fusion-builder' ),
'description' => esc_attr__( 'Set the color of the unfilled part of the progress line. Leave empty to use the border color.', 'fusion-builder' ),
'param_name' => 'autoplay_track_color',
'value' => '',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_indicator',
'value' => 'yes',
'operator' => '==',
],
[
'element' => 'design',
'value' => 'clean',
'operator' => '==',
],
[
'element' => 'autoplay_indicator_style',
'value' => 'background',
'operator' => '!=',
],
],
],
[
'type' => 'range',
'heading' => esc_attr__( 'Rotation Progress Indicator Size', 'fusion-builder' ),
'description' => esc_attr__( 'Set the thickness of the rotation progress line, in pixels. The classic design draws it along the active tab accent border, so it follows "Active Border Size" there.', 'fusion-builder' ),
'param_name' => 'autoplay_indicator_size',
'value' => '',
'default' => $fusion_settings->get( 'tabs_autoplay_indicator_size' ),
'min' => '1',
'max' => '10',
'step' => '1',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_indicator',
'value' => 'yes',
'operator' => '==',
],
// Classic follows its own "Active Border Size" instead.
[
'element' => 'design',
'value' => 'clean',
'operator' => '==',
],
[
'element' => 'autoplay_indicator_style',
'value' => 'line',
'operator' => '==',
],
],
],
[
'type' => 'colorpickeralpha',
'heading' => esc_attr__( 'Play / Pause Button Color', 'fusion-builder' ),
'description' => esc_attr__( 'Set the text and icon color of the play / pause button. Leave empty to use the tab title color, switching to the active tab title color on hover.', 'fusion-builder' ),
'param_name' => 'autoplay_pause_button_color',
'value' => '',
'default' => '',
'group' => esc_attr__( 'Design', 'fusion-builder' ),
'dependency' => [
[
'element' => 'autoplay',
'value' => 'off',
'operator' => '!=',
],
[
'element' => 'autoplay_pause_button',
'value' => 'yes',
'operator' => '==',
],
],
],
// Mobile.
[
'heading' => esc_html__( 'Mobile Mode', 'fusion-builder' ),
/* translators: URL for the tab mobile breakpoint. */
'description' => sprintf( esc_html__( 'Choose the tabs mode for mobile devices. Carousel will be come active only, if tabs don\'t fit the device screen width. The breakpoint can be controlled from the %s.', 'fusion-builder' ), $to_link ),
'param_name' => 'mobile_mode',
'default' => '',
'type' => 'radio_button_set',
'value' => [
'' => esc_attr__( 'Default', 'fusion-builder' ),
'accordion' => esc_attr__( 'Accordion', 'fusion-builder' ),
'toggle' => esc_attr__( 'Toggle', 'fusion-builder' ),
'carousel' => esc_attr__( 'Carousel', 'fusion-builder' ),
],
'group' => esc_html__( 'Mobile', 'fusion-builder' ),
],
[
'heading' => esc_html__( 'Sticky Tabs', 'fusion-builder' ),
'description' => esc_html__( 'Set tabs to sticky for carousel mode on mobile, useful for long content.', 'fusion-builder' ),
'param_name' => 'mobile_sticky_tabs',
'default' => '',
'type' => 'radio_button_set',
'value' => [
'' => esc_attr__( 'Default', 'fusion-builder' ),
'yes' => esc_attr__( 'Yes', 'fusion-builder' ),
'no' => esc_attr__( 'No', 'fusion-builder' ),
],
'group' => esc_html__( 'Mobile', 'fusion-builder' ),
'dependency' => [
[
'element' => 'mobile_mode',
'value' => 'accordion',
'operator' => '!=',
],
[
'element' => 'mobile_mode',
'value' => 'toggle',
'operator' => '!=',
],
],
],
'fusion_conditional_render_placeholder' => [],
],
],
'parent'
)
);
}
add_action( 'fusion_builder_before_init', 'fusion_element_tabs' );
/**
* Map shortcode to Avada Builder.
*
* @since 1.0
*/
function fusion_element_tab() {
fusion_builder_map(
fusion_builder_frontend_data(
'FusionSC_Tabs',
[
'name' => esc_attr__( 'Tab', 'fusion-builder' ),
'shortcode' => 'fusion_tab',
'hide_from_builder' => true,
'allow_generator' => true,
'params' => [
[
'type' => 'textfield',
'heading' => esc_attr__( 'Tab Title', 'fusion-builder' ),
'description' => esc_attr__( 'Title of the tab.', 'fusion-builder' ),
'param_name' => 'title',
'value' => esc_attr__( 'Your Content Goes Here', 'fusion-builder' ),
'placeholder' => true,
'dynamic_data' => true,
],
[
'type' => 'textarea',
'heading' => esc_attr__( 'Tab Description', 'fusion-builder' ),
'description' => esc_attr__( 'A short description that is only shown while this tab is active, and slides open as the tab is selected. Vertical tabs place it under the tab title, inside the tab itself. Horizontal tabs place it between the tab row and the content, since a single taller tab would leave the row ragged. Leave empty for no description.', 'fusion-builder' ),
'param_name' => 'description',
'value' => '',
'dynamic_data' => true,
],
[
'type' => 'iconpicker',
'heading' => esc_attr__( 'Icon', 'fusion-builder' ),
'param_name' => 'icon',
'value' => '',
'description' => esc_attr__( 'Click an icon to select, click again to deselect.', 'fusion-builder' ),
],
[
'heading' => esc_html__( 'Icon Color', 'fusion-builder' ),
'description' => esc_html__( 'Set the color of tabs icon.', 'fusion-builder' ),
'param_name' => 'icon_color',
'default' => '',
'type' => 'colorpickeralpha',
'states' => [
'active' => [
'label' => __( 'Active', 'fusion-builder' ),
'param_name' => 'icon_active_color',
],
],
],
[
'type' => 'tinymce',
'heading' => esc_attr__( 'Tab Content', 'fusion-builder' ),
'description' => esc_attr__( 'Add content for the tab.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => esc_attr__( 'Your Content Goes Here', 'fusion-builder' ),
'placeholder' => true,
'dynamic_data' => true,
],
],
'tag_name' => 'li',
],
'child'
)
);
}
add_action( 'fusion_builder_before_init', 'fusion_element_tab' );