config['self_closing'] = 'no';
$this->config['name'] = __('Fullwidth Sub Menu', 'avia_framework' );
$this->config['tab'] = __('Content Elements', 'avia_framework' );
$this->config['icon'] = AviaBuilder::$path['imagesURL']."sc-submenu.png";
$this->config['order'] = 30;
$this->config['target'] = 'avia-target-insert';
$this->config['shortcode'] = 'av_submenu';
$this->config['shortcode_nested'] = array('av_submenu_item');
$this->config['tooltip'] = __('Display a sub menu', 'avia_framework' );
$this->config['tinyMCE'] = array('disable' => "true");
$this->config['drag-level'] = 1;
$this->config['preview'] = false;
$this->config['disabling_allowed'] = true;
}
function extra_assets()
{
//load css
wp_enqueue_style( 'avia-module-menu' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/menu/menu.css' , array('avia-layout'), false );
//load js
wp_enqueue_script( 'avia-module-menu' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/menu/menu.js' , array('avia-shortcodes'), false, TRUE );
}
/**
* Popup Elements
*
* If this function is defined in a child class the element automatically gets an edit button, that, when pressed
* opens a modal window that allows to edit the element properties
*
* @return void
*/
function popup_elements()
{
global $avia_config;
$menus = array();
if(!empty($_POST) && !empty($_POST['action']) && $_POST['action'] == "avia_ajax_av_submenu")
{
$menus = AviaHelper::list_menus();
}
$this->elements = array(
array(
"name" => __("Which kind of menu do you want to display",'avia_framework' ),
"name" => __("Either use an existing menu, built in Appearance -> Menus or create a simple custom menu here",'avia_framework' ),
"id" => "which_menu",
"type" => "select",
"std" => "center",
"subtype" => array( __('Use existing menu','avia_framework' ) =>'',
__('Build simple custom menu','avia_framework' ) =>'custom',
)
),
array(
"name" => __("Select menu to display", 'avia_framework' ),
"desc" => __("You can create new menus in ", 'avia_framework' )."".__('Appearance -> Menus', 'avia_framework' )."
".__("Please note that Mega Menus are not supported for this element ", 'avia_framework' ),
"id" => "menu",
"type" => "select",
"std" => "",
"required" => array('which_menu', 'not', 'custom'),
"subtype" => $menus
),
array(
"name" => __("Add/Edit submenu item text", 'avia_framework' ),
"desc" => __("Here you can add, remove and edit the submenu item text", 'avia_framework' ),
"type" => "modal_group",
"id" => "content",
"required" => array('which_menu', 'equals', 'custom'),
"modal_title" => __("Edit Text Element", 'avia_framework' ),
"std" => array(
array('title'=>__('Menu Item 1', 'avia_framework' )),
array('title'=>__('Menu Item 2', 'avia_framework' )),
),
'subelements' => array(
array(
"name" => __("Menu Text", 'avia_framework' ),
"desc" => __("Enter the menu text here", 'avia_framework' ) ,
"id" => "title",
"std" => "",
"type" => "input"),
array(
"name" => __("Text Link?", 'avia_framework' ),
"desc" => __("Apply a link to the menu text?", 'avia_framework' ),
"id" => "link",
"type" => "linkpicker",
"fetchTMPL" => true,
"std" => "",
"subtype" => array(
__('Set Manually', 'avia_framework' ) =>'manually',
__('Single Entry', 'avia_framework' ) =>'single',
__('Taxonomy Overview Page', 'avia_framework' )=>'taxonomy',
),
),
array(
"name" => __("Open in new window", 'avia_framework' ),
"desc" => __("Do you want to open the link in a new window", 'avia_framework' ),
"id" => "linktarget",
"required" => array('link', 'not', ''),
"type" => "select",
"std" => "no",
"subtype" => AviaHtmlHelper::linking_options()),
array(
"name" => __("Style", 'avia_framework' ),
"desc" => __("Select the styling of your menu item", 'avia_framework' ),
"id" => "button_style",
"type" => "select",
"std" => "",
"subtype" => array(
__('Default Style', 'avia_framework' ) =>'',
__('Button Style (Colored)', 'avia_framework' ) =>'av-menu-button av-menu-button-colored',
__('Button Style (Bordered)', 'avia_framework' ) =>'av-menu-button av-menu-button-bordered',
),
),),
),
array(
"name" => __("Menu Position",'avia_framework' ),
"name" => __("Aligns the menu either to the left, the right or centers it",'avia_framework' ),
"id" => "position",
"type" => "select",
"std" => "center",
"subtype" => array( __('Left','avia_framework' ) =>'left',
__('Center','avia_framework' ) =>'center',
__('Right','avia_framework' ) =>'right',
)
),
array(
"name" => __("Menu Colors",'avia_framework' ),
"id" => "color",
"desc" => __("The menu will use the color scheme you select. Color schemes are defined on your styling page",'avia_framework' ) .
'
'.__("(Show Styling Page)",'avia_framework' )."",
"type" => "select",
"std" => "main_color",
"subtype" => array_flip($avia_config['color_sets'])
),
array(
"name" => __("Sticky Submenu", 'avia_framework' ),
"desc" => __("If checked the menu will stick at the top of the page once it touches it.", 'avia_framework' ),
"id" => "sticky",
"std" => "true",
"type" => "checkbox"),
array(
"name" => __("Mobile Menu Display",'avia_framework' ),
"desc" => __("How do you want to display the menu on mobile devices",'avia_framework' ),
"id" => "mobile",
"type" => "select",
"std" => "disabled",
"subtype" => array( __('Display full menu (works best if you only got a few menu items)','avia_framework' ) =>'disabled',
__('Display a button to open menu (works best for menus with a lot of menu items)','avia_framework' ) =>'active',
)
),
array(
"name" => __("Hide Mobile Menu Submenu Items", 'avia_framework'),
"desc" => __("By default all menu items of the mobile menu are visible. If you activate this option they will be hidden and a user needs to click on the parent menu item to display the submenus", 'avia_framework'),
"id" => "mobile_submenu",
"required" => array('mobile', 'equals', 'active'),
"type" => "checkbox",
"std" => ""
),
);
}
/**
* Editor Sub Element - this function defines the visual appearance of an element that is displayed within a modal window and on click opens its own modal window
* Works in the same way as Editor Element
* @param array $params this array holds the default values for $content and $args.
* @return $params the return array usually holds an innerHtml key that holds item specific markup.
*/
function editor_sub_element($params)
{
$template = $this->update_template("title", "{{title}}");
$params['innerHtml'] = "";
$params['innerHtml'] .= "