get_icon_styles();
$dropdown_icons = [];
foreach ( $dropdown_svg as $key => & $dropdown_icon ) {
$dropdown_icons[ $key ] = $dropdown_icon['label'];
unset( $dropdown_icon['label'] );
}
unset( $dropdown_icon );
$menus = array(
array(
'value' => 'custom',
'name' => __( 'Custom', 'thrive-cb' ),
),
);
foreach ( tve_get_custom_menus() as $menu ) {
$menu['value'] = $menu['id'];
$menus [] = $menu;
}
$menu = array(
'menu' => array(
'config' => array(
'MenuPalettes' => [
'config' => [],
'extends' => 'Palettes',
],
'MenuSource' => array(
'config' => array(
'label' => __( 'Menu source', 'thrive-cb' ),
'options' => $menus,
),
'extends' => 'Select',
),
'OrderList' => [
'config' => [
'sortable' => true,
'max_levels' => 2,
'tpl' => 'controls/menu/preview-list-item',
],
],
'SelectMenu' => [],
'HoverEffect' => array(
'config' => array(
'name' => __( 'Hover effect', 'thrive-cb' ),
'options' => [
'none' => 'None',
'style_1' => 'Underline',
'style_2' => 'Double line',
'style_3' => 'Brackets',
],
),
'extends' => 'Select',
),
'ContentAlign' => array(
'to' => '.menu-item',
'config' => array(
'name' => __( 'Content alignment', 'thrive-cb' ),
'buttons' => [
[
'icon' => 'format-align-left',
'text' => '',
'value' => 'left',
'default' => true,
],
[
'icon' => 'format-align-center',
'text' => '',
'value' => 'center',
],
[
'icon' => 'format-align-right',
'text' => '',
'value' => 'right',
],
],
),
'extends' => 'ButtonGroup',
),
'Align' => array(
'config' => array(
'buttons' => array(
array(
'icon' => 'a_left',
'value' => 'left',
'tooltip' => __( 'Align Left', 'thrive-cb' ),
),
array(
'icon' => 'a_center',
'value' => 'center',
'default' => true,
'tooltip' => __( 'Align Center', 'thrive-cb' ),
),
array(
'icon' => 'a_right',
'value' => 'right',
'tooltip' => __( 'Align Right', 'thrive-cb' ),
),
array(
'text' => 'FULL',
'value' => 'full',
'tooltip' => __( 'Full Width', 'thrive-cb' ),
),
),
),
'css_suffix' => '.tve-vertical-menu',
),
'HamburgerMenuAlign' => [
'config' => [
'buttons' => [
[
'icon' => 'a_left',
'value' => 'flex-start',
'default' => true,
'tooltip' => __( 'Align Left', 'thrive-cb' ),
],
[
'icon' => 'a_center',
'value' => 'center',
'tooltip' => __( 'Align Center', 'thrive-cb' ),
],
[
'icon' => 'a_right',
'value' => 'flex-end',
'tooltip' => __( 'Align Right', 'thrive-cb' ),
],
],
],
],
'MenuWidth' => array(
'config' => array(
'default' => '0',
'min' => '50',
'max' => '1080',
'label' => __( 'Menu width', 'thrive-cb' ),
'um' => [ 'px', '%' ],
'css' => 'max-width',
),
'css_suffix' => '.tve-vertical-menu',
'extends' => 'Slider',
),
'DropdownDirection' => array(
'config' => array(
'name' => __( 'Expand style', 'thrive-cb' ),
'options' => array(
'vm-toggle' => __( 'Toggle', 'thrive-cb' ),
'vmd-right' => __( 'Drop right', 'thrive-cb' ),
'vmd-left' => __( 'Drop left', 'thrive-cb' ),
),
),
'extends' => 'Select',
),
'DropdownIcon' => array(
'config' => array(
'name' => __( 'Dropdown icon', 'thrive-cb' ),
'options' => $dropdown_icons,
),
'paths' => $dropdown_svg,
),
'DropdownAnimation' => array(
'config' => array(
'name' => __( 'Dropdown animation', 'thrive-cb' ),
'options' => array(
'' => __( 'None (instant)', 'thrive-cb' ),
'da-fade' => __( 'Fade In and Out ', 'thrive-cb' ),
'da-slide1' => __( 'Slide Down #1', 'thrive-cb' ),
'da-slide2' => __( 'Slide Down #2', 'thrive-cb' ),
'da-fold' => __( 'Fold Out', 'thrive-cb' ),
),
),
'extends' => 'Select',
),
'MenuType' => array(
'config' => array(
'options' => [
'horizontal' => __( 'Horizontal', 'thrive-cb' ),
'vertical' => __( 'Vertical', 'thrive-cb' ),
'hamburger' => __( 'Hamburger', 'thrive-cb' ),
],
'name' => __( 'Type', 'thrive-cb' ),
),
'extends' => 'Select',
),
'MenuSpacing' => array(
'config' => array(
'name' => __( 'Spacing', 'thrive-cb' ),
'full-width' => true,
'buttons' => array(
array(
'value' => 'horizontal',
'text' => __( 'Horizontal', 'thrive-cb' ),
),
array(
'value' => 'vertical',
'text' => __( 'Vertical', 'thrive-cb' ),
),
array(
'value' => 'between',
'text' => __( 'Between', 'thrive-cb' ),
),
),
),
'extends' => 'Tabs',
),
'LogoSplit' => array(
'config' => array(
'label' => __( 'Split menu with logo', 'thrive-cb' ),
'default' => false,
),
'extends' => 'Switch',
),
'MenuState' => array(
'config' => array(
'label' => __( 'View expanded menu in editor', 'thrive-cb' ),
'default' => false,
),
'extends' => 'Switch',
),
'MenuOverlay' => array(
'config' => array(
'label' => __( 'Overlay', 'thrive-cb' ),
'default' => false,
),
'extends' => 'Switch',
),
'MenuOverlayColor' => array(
'config' => array(
'default' => 'transparent',
'label' => __( 'Color ', 'thrive-cb' ),
'options' => [
'output' => 'object',
],
),
'extends' => 'ColorPicker',
),
'HorizontalSpacing' => [
'to' => '.tve_w_menu > .menu-item',
'config' => [
'default' => '16',
'min' => '0',
'max' => '100',
'label' => '',
'um' => [ 'px' ],
],
'extends' => 'Slider',
],
'VerticalSpacing' => [
'to' => '.tve_w_menu > .menu-item',
'config' => [
'default' => '1',
'min' => '0',
'max' => '100',
'label' => '',
'um' => [ 'px' ],
],
'extends' => 'Slider',
],
'BetweenSpacing' => [
'to' => '.tve_w_menu > .menu-item',
'config' => [
'default' => 'auto',
'min' => '0',
'max' => '300',
'label' => '',
'um' => [ 'px' ],
],
'extends' => 'Slider',
],
'MobileSide' => array(
'config' => array(
'name' => __( 'Menu display', 'thrive-cb' ),
'options' => [
'tve-mobile-side-right' => 'Off screen, right',
'tve-mobile-side-left' => 'Off screen, left',
'tve-mobile-dropdown' => 'Drop down',
'tve-mobile-side-fullscreen' => 'Full screen overlay',
],
),
'extends' => 'Select',
),
'DisableActiveLinks' => array(
'config' => array(
'label' => __( 'Disable links to current page', 'thrive-cb' ),
),
'extends' => 'Switch',
),
),
'icons' => $this->get_trigger_icons(),
),
'background' => [
'config' => [
'css_suffix' => ' .tve_w_menu',
],
],
'typography' => [
'hidden' => true,
],
'animation' => [ 'hidden' => true ],
'shadow' => [
'config' => [
'css_suffix' => ' .tve_w_menu',
],
],
'borders' => [
'config' => [
'css_suffix' => ' .tve_w_menu',
'Corners' => [
'overflow' => false,
],
],
],
'layout' => array(
'disabled_controls' => [
'Display',
'Width',
'Height',
],
'config' => array(
'MarginAndPadding' => [
'padding_suffix' => ' .tve_w_menu',
],
'Alignment' => array(
'override_buttons' => array(
array( 'icon' => 'a_left', 'value' => 'left', 'data' => [ 'tooltip' => 'Align Left' ] ),
array( 'icon' => 'a_center', 'value' => 'center', 'default' => true, 'data' => [ 'tooltip' => 'Align Center' ] ),
array( 'icon' => 'a_right', 'value' => 'right', 'data' => [ 'tooltip' => 'Align Right' ] ),
array( 'text' => 'FULL', 'value' => 'full', 'tooltip' => __( 'Full Width', 'thrive-cb' ), ),
),
),
),
),
'conditional-display' => [
'hidden' => false,
],
);
return array_merge( $menu, $this->group_component() );
}
/**
* Element category that will be displayed in the sidebar
*
* @return string
*/
public function category() {
return static::get_thrive_advanced_label();
}
/**
* Group Edit Properties
*
* @return array|bool
*/
public function has_group_editing() {
return array(
'elem_selector' => '.thrv_widget_menu',
'select_values' => array(
array(
'value' => 'top_level',
'selector' => '.thrive-shortcode-html ul.tve_w_menu > li:not(.tcb-menu-logo-wrap)',
'element' => '.thrive-shortcode-html li:not(.tcb-menu-logo-wrap)',
'name' => __( 'Top Level Items', 'thrive-cb' ),
/* Translators: %s represents index of the unlocked item */
'singular' => __( '-- Item %s', 'thrive-cb' ),
),
array(
'value' => 'dropdowns',
'selector' => '.tve_w_menu .sub-menu',
'element' => '.tve_w_menu .sub-menu',
'name' => __( 'All Dropdowns', 'thrive-cb' ),
/* Translators: %s represents index of the unlocked item */
'singular' => __( '-- Dropdown %s', 'thrive-cb' ),
),
array(
'value' => 'items',
'selector' => '.thrive-shortcode-html li li',
'element' => '.thrive-shortcode-html li',
'name' => __( 'All Dropdown Items', 'thrive-cb' ),
/* Translators: %s represents index of the unlocked item */
'singular' => __( '-- Item %s', 'thrive-cb' ),
),
array(
'value' => 'menu-images',
'selector' => '.tcb-menu-item-image:not(.tcb-elem-placeholder)',
'element' => '.tcb-menu-item-image',
'name' => __( 'All Menu Images', 'thrive-cb' ),
/* Translators: %s represents index of the unlocked item */
'singular' => __( '-- Menu Image %s', 'thrive-cb' ),
),
array(
'value' => 'menu-images-hamburger',
'selector' => '.tcb-menu-img-hamburger .tcb-mm-image:not(.tcb-elem-placeholder)',
'element' => '.tcb-menu-img-hamburger .tcb-mm-image',
'name' => __( 'All Menu Images', 'thrive-cb' ),
/* Translators: %s represents index of the unlocked item */
'singular' => __( '-- Menu Image %s', 'thrive-cb' ),
),
),
);
}
public function get_icon_styles() {
return [
'none' => [
'label' => 'None',
'up' => '',
'box' => '',
],
'style_1' => [
'label' => 'Angle',
'up' => '',
'box' => '0 0 320 512',
],
'style_2' => [
'label' => 'Chevron',
'up' => '',
'box' => '0 0 448 512',
],
'style_3' => [
'label' => 'Caret',
'up' => '',
'box' => '0 0 320 512',
],
'style_4' => [
'label' => 'Triangle',
'up' => '',
'box' => '0 0 320 512',
],
];
}
public function get_trigger_icons() {
return [
'style_1' => [
'open' => '',
'close' => '',
],
'style_2' => [
'open' => '',
'close' => '',
],
'style_3' => [
'open' => '',
'close' => '',
],
'style_4' => [
'open' => '',
'close' => '',
],
'style_5' => [
'open' => '',
'close' => '',
],
];
}
/**
* Build html for the hamburger trigger icons
*
* @param array $attributes
*
* @return string
*/
public function get_hamburger_trigger_html( $attributes = [] ) {
$sets = $this->get_trigger_icons();
$trigger_icons = empty( $attributes['mobile_icon'] ) ? $sets['style_1'] : $sets[ $attributes['mobile_icon'] ];
$trigger_classes = [ 'tve-m-trigger' ];
if ( ! empty( $attributes['dir'] ) ) {
$trigger_classes[] = 't_' . $attributes['dir'];
}
if ( ! empty( $attributes['color'] ) ) {
$trigger_classes[] = $attributes['color'];
}
return sprintf(
'' .
'%s
' .
'%s
' .
'',
empty( $attributes['trigger_attr'] ) ? '' : sprintf( " data-tve-custom-colour='%s'", $attributes['trigger_attr'] ),
implode( ' ', $trigger_classes ),
$trigger_icons['open'],
$trigger_icons['close']
);
}
/**
* Use another set of cloud templates - since the revamp
*
* @return string
*/
public function get_template_tag() {
return 'menu_v2';
}
/**
* Element info
*
* @return string|string[][]
*/
public function info() {
return [
'instructions' => [
'type' => 'help',
'url' => 'menu',
'link' => 'https://help.thrivethemes.com/en/articles/4425832-how-to-use-the-custom-menu-element',
],
];
}
}