function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     // check whether this item has children, and set $item->hasChildren accordingly
     $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
     // continue with normal behavior
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->has_children = !empty($children_elements[$element->ID]);
     $element->classes[] = $element->current || $element->current_item_ancestor ? 'active' : '';
     $element->classes[] = $element->has_children && 1 !== $max_depth ? 'has-submenu' : '';
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (is_object($args[0])) {
         $args[0]->has_children = !empty($children_elements[$element->{$id_field}]);
         $args[0]->is_bordered = $element->_dfd_mega_menu_bordered == 1;
     }
     if ($depth == 0 && $element->_dfd_mega_menu_enabled == 1 && !empty($children_elements[$element->{$id_field}])) {
         $columns = $element->_dfd_mega_menu_columns;
         $cnt = count($children_elements[$element->{$id_field}]);
         if ($columns > 1 && $cnt > 1) {
             $delim_step = ceil($cnt / $columns);
             for ($i = 0; $i < $cnt; $i++) {
                 if ($i == $cnt - 1 && $cnt % $delim_step !== 0) {
                     $children_elements[$element->{$id_field}][$i]->is_mega_unlast = true;
                 }
                 if ($i == 0 || $i % $delim_step !== 0) {
                     continue;
                 }
                 $children_elements[$element->{$id_field}][$i]->is_mega_delim = true;
             }
         }
     }
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     //we add a property here
     //will be used in override start_el() and class filter
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     //let the parent do the rest of the job !
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #5
0
 public function display_element($el, &$children, $max_depth, $depth = 0, $args, &$output)
 {
     $id = $this->db_fields['id'];
     if (isset($children[$el->{$id}])) {
         $el->classes[] = 'has_children';
     }
     parent::display_element($el, $children, $max_depth, $depth, $args, $output);
 }
 /**
  * Traverse elements to create list from elements.
  *
  * Display one element if the element doesn't have any children otherwise,
  * display the element and its children. Will only traverse up to the max
  * depth and no ignore elements under that depth. It is possible to set the
  * max depth to include all depths, see walk() method.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @since 2.5.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #7
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'menu-has-children';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->is_dropdown = !empty($children_elements[$element->ID]) && ($depth + 1 < $max_depth || $max_depth === 0);
     if ($element->is_dropdown) {
         $element->classes[] = 'dropdown';
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     //we add a property here
     //will be used in override start_el() and class filter
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     $element->classes = apply_filters('tc_nav_menu_css_class', array_filter(empty($element->classes) ? array() : (array) $element->classes), $element, $args, $depth);
     //let the parent do the rest of the job !
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * Traverse elements to create list from elements.
  *
  * Display one element if the element doesn't have any children otherwise,
  * display the element and its children. Will only traverse up to the max
  * depth and no ignore elements under that depth.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @see Walker::start_el()
  * @since 2.5.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     $this->has_children = !empty($children_elements[$element->{$id_field}]);
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'haschild';
         $element->arrow = '<span class="menu-arrow"></span>';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->has_children = !empty($children_elements[$element->ID]);
     if (!empty($element->classes)) {
         $element->classes[] = $element->current || $element->current_item_ancestor ? 'active' : '';
         $element->classes[] = $element->has_children ? 'has-dropdown' : '';
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #13
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'has_children has-children';
         wp_enqueue_style('cpotheme-fontawesome');
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'has-dropdown';
         //enter any classname you like here!
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     // check whether there are children for the given ID
     $element->hasChildren = isset($children_elements[$element->{$id_field}]) && !empty($children_elements[$element->{$id_field}]);
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'menu-item-parent';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #16
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         array_push($element->classes, 'has_sublevel');
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * Adjust classes for individual menu items.
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if ($element->current) {
         $element->classes[] = 'active';
     }
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     if ($element->is_dropdown && 0 == $depth) {
         $element->classes[] = 'dropdown';
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * Traverse elements to create list from elements.
  *
  * Calls parent function in wp-includes/class-wp-walker.php
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     //Add indicators for top level menu items with submenus
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $this->dt_menu_parents[] = $element->{$id_field};
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     if ($element->is_dropdown) {
         if ($depth === 0) {
             $element->classes[] = 'dropdown';
         } elseif ($depth > 0) {
             $element->classes[] = 'dropdown-submenu';
         }
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}]) && $element->menu_item_parent == 0) {
         $element->title = $element->title . '<span class="sub-indicator"><i class="icon icon-angle-down"></i></span>';
         $element->classes[] = 'sf-with-ul';
     }
     if (!empty($children_elements[$element->{$id_field}]) && $element->menu_item_parent != 0) {
         $element->title = $element->title . '<span class="sub-indicator"><i class="icon icon-angle-right"></i></span>';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * Traverse elements to create list from elements.
  *
  * Calls parent function in wp-includes/class-wp-walker.php
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     //Add indicators for top level menu items with submenus
     $id_field = $this->db_fields['id'];
     if ($depth == 0 && !empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'mega-with-sub';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * {@inheritdoc}
  */
 public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     // If it's a nav menu item, check permissions against the post/page that the
     // nav menu item points to, otherwise check the element itself.
     if (isset($element->post_type) && $element->post_type == 'nav_menu_item') {
         $object_id = $element->object_id;
     } else {
         $object_id = $element->{$this->db_fields['id']};
     }
     if (WordPressAccessControl::check_conditions($object_id) || get_option('wpac_show_in_menus', 'with_access') == 'always') {
         if (in_array($element->{$this->db_fields['parent']}, $this->track_ids) || $element->{$this->db_fields['parent']} == 0) {
             $this->track_ids[] = $element->{$this->db_fields['id']};
             $this->filter_children($element->{$this->db_fields['id']}, $children_elements);
             $this->original_walker->display_element($element, $children_elements, $max_depth, $depth, $args, $output);
         } else {
             $this->truncate_children($element->{$this->db_fields['id']}, $children_elements);
         }
     } else {
         $this->truncate_children($element->{$this->db_fields['id']}, $children_elements);
     }
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     // For nested levels we want to check if the parent is mega-menu enabled. If so, we shouldn't print the children.
     if ($depth == 1) {
         $parent_id = $element->menu_item_parent;
         $selection = get_post_meta($parent_id, 'suf_mm_warea', true);
         if (isset($selection) && $selection != '') {
             return;
         }
     }
     // If not a mega-menu, display as you would
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     // Check if element as a 'current element' class
     $current_element_markers = array('current-menu-item', 'current-menu-parent', 'current-menu-ancestor');
     $current_class = array_intersect($current_element_markers, $element->classes);
     // If element has a 'current' class, it is an ancestor of the current element
     $ancestor_of_current = !empty($current_class);
     // If this is a top-level link and not the current, or ancestor of the current menu item - stop here.
     if (!$ancestor_of_current && $depth == 0) {
         return;
     }
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}]) && $depth == 0) {
         $element->classes[] = 'dropdown';
         $element->title .= ' <i class="icon-angle-down"></i>';
     }
     if (!empty($children_elements[$element->{$id_field}]) && $depth > 0) {
         $element->classes[] = 'dropdown';
         $element->title .= ' <i class="icon-angle-right"></i>';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 public function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->is_subitem = !empty($children_elements[$element->ID]) && ($depth + 1 < $max_depth || $max_depth === 0);
     if ($element->is_subitem) {
         foreach ($children_elements[$element->ID] as $child) {
             if ($child->current_item_parent || Utils\url_compare($this->archive, $child->url)) {
                 $element->classes[] = 'active';
             }
         }
     }
     $element->is_active = !empty($element->url) && strpos($this->archive, $element->url);
     if ($element->is_active) {
         $element->classes[] = 'active';
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}]) && $depth == 0) {
         $element->classes[] = 'dropdown';
         if (wpex_option('menu_arrow_down', '0') == '1') {
             $element->title .= ' <span class="nav-arrow fa fa-angle-down"></span>';
         }
     }
     if (!empty($children_elements[$element->{$id_field}]) && $depth > 0) {
         $element->classes[] = 'dropdown';
         if (wpex_option('menu_arrow_side', '1') == '1') {
             $element->title .= ' <span class="nav-arrow fa fa-angle-right"></span>';
         }
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 public function display_element($element, &$children_elements, $max_depth, $depth = 0, $args = [], &$output)
 {
     $element->is_dropdown = !empty($children_elements[$element->ID]) && ($depth + 1 < $max_depth || $max_depth === 0);
     if (!is_object($args[0])) {
         $args[0] = (object) $args[0];
     }
     $args[0]->current_depth = $depth;
     $args[0]->max_depth = $max_depth;
     $classes = $element->classes;
     //$classes[] = $args[0]->menu_class . '__depth--' . ( $depth + 1 );
     $classes[] = $args[0]->menu_class . '_item';
     if ($element->is_dropdown) {
         //$classes[] = 'nested';
     }
     $element->classes = $classes;
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #29
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if ($element->current) {
         $element->classes[] = 'active';
     }
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     if ($element->is_dropdown) {
         if ($depth === 0) {
             $element->classes[] = 'dropdown-toggle nav-toggle';
         } elseif ($depth === 1) {
             // Extra level of dropdown menu,
             // as seen in http://twitter.github.com/bootstrap/components.html#dropdowns
             $element->classes[] = 'dropdown-submenu';
         }
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Exemple #30
-1
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (is_object($args[0])) {
         $args[0]->has_children = !empty($children_elements[$element->{$id_field}]);
     }
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }