/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args * @param int $id Menu item ID. * @param object $args */ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $item_output = $class_columns = ''; // Set some vars // Megamenu is enabled if (Avada()->settings->get('disable_megamenu')) { if (0 === $depth) { $this->menu_megamenu_status = get_post_meta($item->ID, '_menu_item_fusion_megamenu_status', true); $this->menu_megamenu_width = get_post_meta($item->ID, '_menu_item_fusion_megamenu_width', true); $allowed_columns = get_post_meta($item->ID, '_menu_item_fusion_megamenu_columns', true); if ('auto' != $allowed_columns) { $this->max_num_of_columns = $allowed_columns; } $this->num_of_columns = $this->total_num_of_columns = 0; $this->num_of_rows = 1; $this->menu_megamenu_rowwidth_matrix = array(); $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] = 0; } $this->menu_style = get_post_meta($item->ID, '_menu_item_fusion_menu_style', true); $this->menu_megamenu_title = get_post_meta($item->ID, '_menu_item_fusion_megamenu_title', true); $this->menu_megamenu_widgetarea = get_post_meta($item->ID, '_menu_item_fusion_megamenu_widgetarea', true); $this->menu_megamenu_icon = get_post_meta($item->ID, '_menu_item_fusion_megamenu_icon', true); $this->menu_megamenu_thumbnail = get_post_meta($item->ID, '_menu_item_fusion_megamenu_thumbnail', true); // Megamenu is disabled } else { $this->menu_megamenu_status = 'disabled'; $this->menu_style = get_post_meta($item->ID, '_menu_item_fusion_menu_style', true); $this->menu_megamenu_icon = get_post_meta($item->ID, '_menu_item_fusion_megamenu_icon', true); } // We are inside a megamenu if (1 === $depth && 'enabled' == $this->menu_megamenu_status) { if (get_post_meta($item->ID, '_menu_item_fusion_megamenu_columnwidth', true)) { $this->menu_megamenu_columnwidth = get_post_meta($item->ID, '_menu_item_fusion_megamenu_columnwidth', true); } else { if ('fullwidth' == $this->menu_megamenu_width) { $this->menu_megamenu_columnwidth = 100 / $this->max_num_of_columns . '%'; } else { if ($this->max_num_of_columns == '1') { $this->menu_megamenu_columnwidth = '100%'; } else { $this->menu_megamenu_columnwidth = '16.6666%'; } } //$this->menu_megamenu_columnwidth = 100 / $this->max_num_of_columns . '%'; } $this->num_of_columns++; $this->total_num_of_columns++; // check if we need to start a new row if ($this->num_of_columns > $this->max_num_of_columns) { $this->num_of_columns = 1; $this->num_of_rows++; // start new row width calculation $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] = floatval($this->menu_megamenu_columnwidth) / 100; $output .= '</ul><ul class="fusion-megamenu fusion-megamenu-row-' . $this->num_of_rows . ' {row_number_' . $this->num_of_rows . '}" {row_width_' . $this->num_of_rows . '}>'; } else { $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] += floatval($this->menu_megamenu_columnwidth) / 100; } $this->submenu_matrix[$this->num_of_rows] = $this->num_of_columns; if ($this->max_num_of_columns < $this->num_of_columns) { $this->max_num_of_columns = $this->num_of_columns; } $title = apply_filters('the_title', $item->title, $item->ID); if (!((empty($item->url) || '#' == $item->url || 'http://' == $item->url) && 'disabled' == $this->menu_megamenu_title)) { $heading = do_shortcode($title); $link = ''; $link_closing = ''; $target = ''; if (!empty($item->url) && '#' != $item->url && 'http://' != $item->url) { if (!empty($item->target)) { $target = ' target="' . $item->target . '"'; } $link = '<a href="' . $item->url . '"' . $target . '>'; $link_closing = '</a>'; } /* check if we need to set an image */ $title_enhance = ''; if (!empty($this->menu_megamenu_thumbnail)) { $title_enhance = '<span class="fusion-megamenu-icon"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon)) { $title_enhance = '<span class="fusion-megamenu-icon"><i class="fa glyphicon ' . avada_font_awesome_name_handler($this->menu_megamenu_icon) . '"></i></span>'; } elseif ('disabled' == $this->menu_megamenu_title) { $title_enhance = '<span class="fusion-megamenu-bullet"></span>'; } $heading = $link . $title_enhance . $title . $link_closing; if ('disabled' != $this->menu_megamenu_title) { $item_output .= "<div class='fusion-megamenu-title'>" . $heading . "</div>"; } else { $item_output .= $heading; } } if ($this->menu_megamenu_widgetarea && is_active_sidebar($this->menu_megamenu_widgetarea)) { ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= '<div class="fusion-megamenu-widgets-container second-level-widget">' . ob_get_clean() . '</div>'; } $class_columns = ' {current_row_' . $this->num_of_rows . '}'; } else { if (2 === $depth && 'enabled' == $this->menu_megamenu_status && $this->menu_megamenu_widgetarea) { if (is_active_sidebar($this->menu_megamenu_widgetarea)) { ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= '<div class="fusion-megamenu-widgets-container third-level-widget">' . ob_get_clean() . '</div>'; } } else { $atts = array(); $atts['title'] = !empty($item->attr_title) ? esc_attr($item->attr_title) : ''; $atts['target'] = !empty($item->target) ? esc_attr($item->target) : ''; $atts['rel'] = !empty($item->xfn) ? esc_attr($item->xfn) : ''; $atts['href'] = !empty($item->url) ? esc_attr($item->url) : ''; $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth); $attributes = ''; foreach ($atts as $attr => $value) { if (!empty($value)) { $value = 'href' === $attr ? esc_url($value) : esc_attr($value); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output .= $args->before . '<a ' . $attributes . '>'; // For right side header add the caret icon at the beginning if (0 === $depth && $args->has_children && Avada()->settings->get('menu_display_dropdown_indicator') && 'v6' != Avada()->settings->get('header_layout') && 'Right' == Avada()->settings->get('header_position')) { $item_output .= ' <span class="fusion-caret"><i class="fusion-dropdown-indicator"></i></span>'; } // Check if we need to set an image $icon_wrapper_class = 'fusion-megamenu-icon'; if (0 === $depth && $this->menu_style) { $icon_wrapper_class = is_rtl() ? 'button-icon-divider-right' : 'button-icon-divider-left'; } $icon = ''; if (!empty($this->menu_megamenu_thumbnail) && 'enabled' == $this->menu_megamenu_status) { $icon = '<span class="' . $icon_wrapper_class . ' fusion-megamenu-image"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon)) { $icon = '<span class="' . $icon_wrapper_class . '"><i class="fa glyphicon ' . $this->menu_megamenu_icon . '"></i></span>'; } elseif (0 !== $depth && 'enabled' == $this->menu_megamenu_status) { $icon = '<span class="fusion-megamenu-bullet"></span>'; } $classes = ''; // Check if we have a menu button if (0 === $depth) { $classes = 'menu-text'; if ($this->menu_style) { $classes .= ' fusion-button button-default ' . str_replace('fusion-', '', $this->menu_style); // Button should have 3D effect if ('3d' == Avada()->settings->get('button_type')) { $classes .= ' button-3d'; } } $item_output .= '<span class="' . $classes . '">' . $icon; // Normal menu item } else { $item_output .= $icon . '<span class="' . $classes . '">'; } $title = $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if (false !== strpos($icon, 'button-icon-divider-left')) { $title = '<span class="fusion-button-text-left">' . $title . '</span>'; } elseif (false !== strpos($icon, 'button-icon-divider-right')) { $title = '<span class="fusion-button-text-right">' . $title . '</span>'; } $item_output .= $title; $item_output .= '</span>'; // For top header and left side header add the caret icon at the end if (0 === $depth && $args->has_children && Avada()->settings->get('menu_display_dropdown_indicator') && 'v6' != Avada()->settings->get('header_layout') && 'Right' != Avada()->settings->get('header_position')) { $item_output .= ' <span class="fusion-caret"><i class="fusion-dropdown-indicator"></i></span>'; } $item_output .= '</a>' . $args->after; } } // check if we need to apply a divider if ('enabled' != $this->menu_megamenu_status && (0 == strcasecmp($item->attr_title, 'divider') || 0 == strcasecmp($item->title, 'divider'))) { $output .= '<li role="presentation" class="divider">'; } else { $class_names = ''; $column_width = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); if (0 === $depth && $args->has_children) { $class_names .= 'enabled' == $this->menu_megamenu_status ? ' fusion-megamenu-menu' : ' fusion-dropdown-menu'; } if (0 === $depth && $this->menu_style) { $class_names .= ' fusion-menu-item-button'; } if (1 === $depth) { if ('enabled' == $this->menu_megamenu_status) { $class_names .= ' fusion-megamenu-submenu'; if ('disabled' == $this->menu_megamenu_title) { $class_names .= ' fusion-megamenu-submenu-notitle'; } if ('fullwidth' != $this->menu_megamenu_width) { $width = $this->menu_megamenu_maxwidth * floatval($this->menu_megamenu_columnwidth) / 100; $column_width = 'style="width:' . $width . 'px;max-width:' . $width . 'px;" data-width="' . $width . '"'; } } else { $class_names .= ' fusion-dropdown-submenu'; } } $class_names = $class_names ? ' class="' . esc_attr($class_names) . $class_columns . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr($id) . '"' : ''; $output .= '<li ' . $id . ' ' . $class_names . ' ' . $column_width . ' >'; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $smof_data; $item_output = $class_columns = ''; $indent = $depth ? str_repeat("\t", $depth) : ''; /* set some vars */ if ($depth === 0) { $this->menu_megamenu_status = get_post_meta($item->ID, '_menu_item_fusion_megamenu_status', true); $this->menu_megamenu_width = get_post_meta($item->ID, '_menu_item_fusion_megamenu_width', true); $allowed_columns = get_post_meta($item->ID, '_menu_item_fusion_megamenu_columns', true); if ($allowed_columns != "auto") { $this->max_num_of_columns = $allowed_columns; } $this->num_of_columns = $this->total_num_of_columns = 0; } $this->menu_megamenu_title = get_post_meta($item->ID, '_menu_item_fusion_megamenu_title', true); $this->menu_megamenu_widgetarea = get_post_meta($item->ID, '_menu_item_fusion_megamenu_widgetarea', true); $this->menu_megamenu_icon = get_post_meta($item->ID, '_menu_item_fusion_megamenu_icon', true); $this->menu_megamenu_thumbnail = get_post_meta($item->ID, '_menu_item_fusion_megamenu_thumbnail', true); /* we are inside a mega menu */ if ($depth === 1 && $this->menu_megamenu_status == "enabled") { $this->num_of_columns++; $this->total_num_of_columns++; /* check if we need to start a new row */ if ($this->num_of_columns > $this->max_num_of_columns) { $this->num_of_columns = 1; $this->num_of_rows++; $output .= "\n</ul>\n<ul class=\"fusion-megamenu fusion-megamenu-row-" . $this->num_of_rows . " {row_number_" . $this->num_of_rows . "}\" {row_width_" . $this->num_of_rows . "}>\n"; } $this->submenu_matrix[$this->num_of_rows] = $this->num_of_columns; if ($this->max_num_of_columns < $this->num_of_columns) { $this->max_num_of_columns = $this->num_of_columns; } $title = apply_filters('the_title', $item->title, $item->ID); if (!((empty($item->url) || $item->url == "#" || $item->url == 'http://') && $this->menu_megamenu_title == 'disabled')) { $heading = do_shortcode($title); $link = ''; $link_closing = ''; if (!empty($item->url) && $item->url != "#" && $item->url != 'http://') { $link = '<a href="' . $item->url . '">'; $link_closing = '</a>'; } /* check if we need to set an image */ $title_enhance = ''; if (!empty($this->menu_megamenu_thumbnail)) { $title_enhance = '<span class="fusion-megamenu-icon"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon)) { $title_enhance = '<span class="fusion-megamenu-icon"><i class="fa glyphicon ' . avada_font_awesome_name_handler($this->menu_megamenu_icon) . '"></i></span>'; } elseif ($this->menu_megamenu_title == 'disabled') { $title_enhance = '<span class="fusion-megamenu-bullet"></span>'; } $heading = sprintf('%s%s%s%s', $link, $title_enhance, $title, $link_closing); if ($this->menu_megamenu_title != 'disabled') { $item_output .= "<h3 class='fusion-megamenu-title'>" . $heading . "</h3>"; } else { $item_output .= $heading; } } if ($this->menu_megamenu_widgetarea && is_active_sidebar($this->menu_megamenu_widgetarea)) { $item_output .= '<div class="fusion-megamenu-widgets-container second-level-widget">'; ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= ob_get_clean() . '</div>'; } $class_columns = ' {current_row_' . $this->num_of_rows . '}'; } else { if ($depth === 2 && $this->menu_megamenu_widgetarea && $this->menu_megamenu_status == "enabled") { if (is_active_sidebar($this->menu_megamenu_widgetarea)) { $item_output .= '<div class="fusion-megamenu-widgets-container third-level-widget">'; ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= ob_get_clean() . '</div>'; } } else { $atts = array(); $atts['title'] = !empty($item->attr_title) ? 'title="' . esc_attr($item->attr_title) . '"' : ''; $atts['target'] = !empty($item->target) ? 'target="' . esc_attr($item->target) . '"' : ''; $atts['rel'] = !empty($item->xfn) ? 'rel="' . esc_attr($item->xfn) . '"' : ''; $atts['url'] = !empty($item->url) ? 'href="' . esc_attr($item->url) . '"' : ''; $attributes = implode(' ', $atts); $item_output .= $args->before; /* check if ne need to set an image */ if (!empty($this->menu_megamenu_thumbnail) && $this->menu_megamenu_status == "enabled") { $item_output .= '<a ' . $attributes . '><span class="fusion-megamenu-icon"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon) && $this->menu_megamenu_status == "enabled") { $item_output .= '<a ' . $attributes . '><span class="fusion-megamenu-icon text-menu-icon"><i class="fa glyphicon ' . avada_font_awesome_name_handler($this->menu_megamenu_icon) . '"></i></span>'; } elseif ($depth !== 0 && $this->menu_megamenu_status == "enabled") { $item_output .= '<a ' . $attributes . '><span class="fusion-megamenu-bullet"></span>'; } else { $item_output .= '<a ' . $attributes . '>'; } if (!empty($this->menu_megamenu_icon) && $this->menu_megamenu_status == "enabled") { $item_output .= '<span class="menu-text">'; } $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if (!empty($this->menu_megamenu_icon) && $this->menu_megamenu_status == "enabled") { $item_output .= '</span>'; } if ($depth === 0 && $args->has_children) { $item_output .= ' <span class="caret"></span></a>'; } else { $item_output .= '</a>'; } $item_output .= $args->after; } } /* check if we need to apply a divider */ if ($this->menu_megamenu_status != "enabled" && (strcasecmp($item->attr_title, 'divider') == 0 || strcasecmp($item->title, 'divider') == 0)) { $output .= $indent . '<li role="presentation" class="divider">'; } else { $indent = $depth ? str_repeat("\t", $depth) : ''; $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); if ($depth === 0 && $args->has_children) { if ($this->menu_megamenu_status == "enabled") { $class_names .= ' fusion-megamenu-menu'; } else { $class_names .= ' fusion-dropdown-menu'; } } if ($depth === 1) { if ($this->menu_megamenu_status == "enabled") { $class_names .= ' fusion-megamenu-submenu'; } else { $class_names .= ' fusion-dropdown-submenu'; } } $class_names = $class_names ? ' class="' . esc_attr($class_names) . $class_columns . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr($id) . '"' : ''; $output .= $indent . '<li' . $id . $value . $class_names . '>'; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $item_output = $class_columns = ''; $indent = $depth ? str_repeat("\t", $depth) : ''; // Set some vars // Megamenu is enabled if (!Avada()->settings->get('disable_megamenu')) { if ($depth === 0) { $this->menu_megamenu_status = get_post_meta($item->ID, '_menu_item_fusion_megamenu_status', true); $this->menu_megamenu_width = get_post_meta($item->ID, '_menu_item_fusion_megamenu_width', true); $allowed_columns = get_post_meta($item->ID, '_menu_item_fusion_megamenu_columns', true); if ($allowed_columns != "auto") { $this->max_num_of_columns = $allowed_columns; } $this->num_of_columns = $this->total_num_of_columns = 0; $this->num_of_rows = 1; $this->menu_megamenu_rowwidth_matrix = array(); $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] = 0; } $this->menu_style = get_post_meta($item->ID, '_menu_item_fusion_menu_style', true); $this->menu_megamenu_title = get_post_meta($item->ID, '_menu_item_fusion_megamenu_title', true); $this->menu_megamenu_widgetarea = get_post_meta($item->ID, '_menu_item_fusion_megamenu_widgetarea', true); $this->menu_megamenu_icon = get_post_meta($item->ID, '_menu_item_fusion_megamenu_icon', true); $this->menu_megamenu_thumbnail = get_post_meta($item->ID, '_menu_item_fusion_megamenu_thumbnail', true); // Megamenu is disabled } else { $this->menu_megamenu_status = 'disabled'; $this->menu_style = get_post_meta($item->ID, '_menu_item_fusion_menu_style', true); $this->menu_megamenu_icon = get_post_meta($item->ID, '_menu_item_fusion_megamenu_icon', true); } /* we are inside a mega menu */ if ($depth === 1 && $this->menu_megamenu_status == "enabled") { if (get_post_meta($item->ID, '_menu_item_fusion_megamenu_columnwidth', true)) { $this->menu_megamenu_columnwidth = get_post_meta($item->ID, '_menu_item_fusion_megamenu_columnwidth', true); } else { if ($this->menu_megamenu_width == "fullwidth") { $this->menu_megamenu_columnwidth = 100 / $this->max_num_of_columns . '%'; } else { $this->menu_megamenu_columnwidth = '16.6666%'; } } $this->num_of_columns++; $this->total_num_of_columns++; /* check if we need to start a new row */ if ($this->num_of_columns > $this->max_num_of_columns) { $this->num_of_columns = 1; $this->num_of_rows++; // start new row width calculation $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] = floatval($this->menu_megamenu_columnwidth) / 100; $output .= "\n</ul>\n<ul class=\"fusion-megamenu fusion-megamenu-row-" . $this->num_of_rows . " {row_number_" . $this->num_of_rows . "}\" {row_width_" . $this->num_of_rows . "}>\n"; } else { $this->menu_megamenu_rowwidth_matrix[$this->num_of_rows] += floatval($this->menu_megamenu_columnwidth) / 100; } $this->submenu_matrix[$this->num_of_rows] = $this->num_of_columns; if ($this->max_num_of_columns < $this->num_of_columns) { $this->max_num_of_columns = $this->num_of_columns; } $title = apply_filters('the_title', $item->title, $item->ID); if (!((empty($item->url) || $item->url == "#" || $item->url == 'http://') && $this->menu_megamenu_title == 'disabled')) { $heading = do_shortcode($title); $link = ''; $link_closing = ''; if (!empty($item->url) && $item->url != "#" && $item->url != 'http://') { $link = '<a href="' . $item->url . '">'; $link_closing = '</a>'; } /* check if we need to set an image */ $title_enhance = ''; if (!empty($this->menu_megamenu_thumbnail)) { $title_enhance = '<span class="fusion-megamenu-icon"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon)) { $title_enhance = '<span class="fusion-megamenu-icon"><i class="fa glyphicon ' . avada_font_awesome_name_handler($this->menu_megamenu_icon) . '"></i></span>'; } elseif ($this->menu_megamenu_title == 'disabled') { $title_enhance = '<span class="fusion-megamenu-bullet"></span>'; } $heading = sprintf('%s%s%s%s', $link, $title_enhance, $title, $link_closing); if ($this->menu_megamenu_title != 'disabled') { $item_output .= "<div class='fusion-megamenu-title'>" . $heading . "</div>"; } else { $item_output .= $heading; } } if ($this->menu_megamenu_widgetarea && is_active_sidebar($this->menu_megamenu_widgetarea)) { $item_output .= '<div class="fusion-megamenu-widgets-container second-level-widget">'; ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= ob_get_clean() . '</div>'; } $class_columns = ' {current_row_' . $this->num_of_rows . '}'; } else { if ($depth === 2 && $this->menu_megamenu_status == "enabled" && $this->menu_megamenu_widgetarea) { if (is_active_sidebar($this->menu_megamenu_widgetarea)) { $item_output .= '<div class="fusion-megamenu-widgets-container third-level-widget">'; ob_start(); dynamic_sidebar($this->menu_megamenu_widgetarea); $item_output .= ob_get_clean() . '</div>'; } } else { $atts = array(); $atts['title'] = !empty($item->attr_title) ? esc_attr($item->attr_title) : ''; $atts['target'] = !empty($item->target) ? esc_attr($item->target) : ''; $atts['rel'] = !empty($item->xfn) ? esc_attr($item->xfn) : ''; $atts['href'] = !empty($item->url) ? esc_attr($item->url) : ''; $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth); $attributes = ''; foreach ($atts as $attr => $value) { if (!empty($value)) { $value = 'href' === $attr ? esc_url($value) : esc_attr($value); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output .= sprintf('%s<a %s>', $args->before, $attributes); // For right side header add the caret icon at the beginning if ($depth === 0 && $args->has_children && Avada()->settings->get('menu_display_dropdown_indicator') && Avada()->settings->get('header_position') == 'Right') { $item_output .= ' <span class="fusion-caret"><i class="fusion-dropdown-indicator"></i></span>'; } // Check if we need to set an image $icon_wrapper_class = 'fusion-megamenu-icon'; if ($depth === 0 && $this->menu_style) { if (is_rtl()) { $icon_wrapper_class = 'button-icon-divider-right'; } else { $icon_wrapper_class = 'button-icon-divider-left'; } } $icon = ''; if (!empty($this->menu_megamenu_thumbnail) && $this->menu_megamenu_status == "enabled") { $icon = '<span class="' . $icon_wrapper_class . ' fusion-megamenu-image"><img src="' . $this->menu_megamenu_thumbnail . '"></span>'; } elseif (!empty($this->menu_megamenu_icon)) { $icon = '<span class="' . $icon_wrapper_class . '"><i class="fa glyphicon ' . $this->menu_megamenu_icon . '"></i></span>'; } elseif ($depth !== 0 && $this->menu_megamenu_status == "enabled") { $icon = '<span class="fusion-megamenu-bullet"></span>'; } $classes = ''; // Check if we have a menu button if ($depth === 0) { if ($this->menu_style) { $classes .= sprintf('menu-text fusion-button button-default %s', str_replace('fusion-', '', $this->menu_style)); // Button should have §D effect if (Avada()->settings->get('button_type') == '3d') { $classes .= ' button-3d'; } } else { $classes = 'menu-text'; } $item_output .= sprintf('<span class="%s">%s', $classes, $icon); // Normal menu item } else { $item_output .= sprintf('%s<span class="%s">', $icon, $classes); } $title = $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if (strpos($icon, 'button-icon-divider-left') !== FALSE) { $title = sprintf('<span class="fusion-button-text-left">%s</span>', $title); } elseif (strpos($icon, 'button-icon-divider-right') !== FALSE) { $title = sprintf('<span class="fusion-button-text-right">%s</span>', $title); } $item_output .= $title; $item_output .= '</span>'; // For top header and left side header add the caret icon at the end if ($depth === 0 && $args->has_children && Avada()->settings->get('menu_display_dropdown_indicator') && Avada()->settings->get('header_position') != 'Right') { $item_output .= ' <span class="fusion-caret"><i class="fusion-dropdown-indicator"></i></span>'; } $item_output .= '</a>' . $args->after; } } /* check if we need to apply a divider */ if ($this->menu_megamenu_status != "enabled" && (strcasecmp($item->attr_title, 'divider') == 0 || strcasecmp($item->title, 'divider') == 0)) { $output .= $indent . '<li role="presentation" class="divider">'; } else { $indent = $depth ? str_repeat("\t", $depth) : ''; $class_names = ''; $column_width = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); if ($depth === 0 && $args->has_children) { if ($this->menu_megamenu_status == "enabled") { $class_names .= ' fusion-megamenu-menu'; } else { $class_names .= ' fusion-dropdown-menu'; } } if ($depth === 0 && $this->menu_style) { $class_names .= ' fusion-menu-item-button'; } if ($depth === 1) { if ($this->menu_megamenu_status == "enabled") { $class_names .= ' fusion-megamenu-submenu'; if ($this->menu_megamenu_title == 'disabled') { $class_names .= ' fusion-megamenu-submenu-notitle'; } if ($this->menu_megamenu_width != "fullwidth") { $width = $this->menu_megamenu_maxwidth * floatval($this->menu_megamenu_columnwidth) / 100; $column_width = sprintf('style="width:%spx;max-width:%spx;" data-width="%s"', $width, $width, $width); } } else { $class_names .= ' fusion-dropdown-submenu'; } } $class_names = $class_names ? ' class="' . esc_attr($class_names) . $class_columns . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr($id) . '"' : ''; $output .= sprintf('%s<li %s %s %s >', $indent, $id, $class_names, $column_width); $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } }