Instantly share code, notes, and snippets.
Last active
January 10, 2019 05:56
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
-
Save iamrobert/cc6f0c37762c96f33216e6cb5f4c2148 to your computer and use it in GitHub Desktop.
Foundation 6.5 Mega Menu Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @package Joomla.Site | |
| * @subpackage mod_menu | |
| * | |
| * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. | |
| * @license GNU General Public License version 2 or later; see LICENSE.txt | |
| */ | |
| defined( '_JEXEC' )or die; | |
| // Note. It is important to remove spaces between elements. | |
| ?> | |
| <ul data-responsive-menu="drilldown mainnav-dropdown" data-auto-height="true" data-animate-height="true" data-parent-link="true" class="dropdown medium-horizontal menu"> | |
| <?php | |
| // Test if this is the last item | |
| $level_check = 1; | |
| $add_child = true; | |
| $megachild = ''; | |
| foreach ( $list as $i => & $item ): | |
| if ( $add_child == false ) { | |
| if ( $level_check < $item->level ) { | |
| continue; | |
| } elseif ( $level_check == $item->level ) { | |
| $add_child = true; | |
| } | |
| } | |
| if ( $item->anchor_css == 'off' ) { | |
| $level_check = $item->level; | |
| $add_child = false; | |
| } | |
| $class = 'item-' . $item->id; | |
| if ( $item->id == $active_id ) { | |
| $class .= ' current'; | |
| } | |
| if ( in_array( $item->id, $path ) ) { | |
| $class .= ' active'; | |
| } elseif ( $item->type == 'alias' ) { | |
| $aliasToId = $item->params->get( 'aliasoptions' ); | |
| if ( count( $path ) > 0 && $aliasToId == $path[ count( $path ) - 1 ] ) { | |
| $class .= ' active'; | |
| } elseif ( in_array( $aliasToId, $path ) ) { | |
| $class .= ' alias-parent-active'; | |
| } | |
| } | |
| if ( $item->deeper ) { | |
| if ( $add_child == true ) { | |
| $class .= ' deeper '; | |
| } | |
| } | |
| if ( $item->parent ) { | |
| if ( $add_child == true ) { | |
| $class .= ' parent has-submenu'; | |
| } | |
| } | |
| //MEGA MENU vertical dropdown-wrapper hide-sm | |
| if ( strpos( $item->anchor_css, 'mega' ) !== false ) { | |
| $class .= ' megamenu'; | |
| $megachild = ' dropdown-wrapper hide-sm'; | |
| } | |
| if ( strpos( $item->title, 'col1' ) !== false ) { | |
| echo '<li> | |
| <div class="grid-x"> | |
| <div class="cell auto"><ul>'; | |
| } | |
| //COLEND is for end colstart col2 | |
| if ( strpos( $item->title, 'colend' ) !== false ) { | |
| echo '</ul> </div><div class="cell auto"><ul>'; | |
| } | |
| if ( strpos( $item->title, 'rowend' ) !== false ) { | |
| echo '</ul></div></div>'; | |
| } | |
| if ( !empty( $class ) ) { | |
| $class = ' class="' . trim( $class ) . '"'; | |
| } | |
| if ( ( strpos( $item->title, 'col1' ) === false ) && ( strpos( $item->title, 'rowend' ) === false ) && ( strpos( $item->title, 'colend' ) === false ) ) { | |
| //if (strpos($item->title,'col1') !== false || strpos($item->title,'rowend') !== false || strpos($item->title,'colend') !== false || strpos($item->title,'expandstart') !== false || strpos($item->title,'expandend') !== false) { | |
| echo '<li' . $class . '>'; | |
| } | |
| // Render the menu item. | |
| switch ( $item->type ): | |
| case 'separator': | |
| case 'url': | |
| case 'component': | |
| require JModuleHelper::getLayoutPath( 'mod_menu', 'default_' . $item->type ); | |
| break; | |
| default: | |
| require JModuleHelper::getLayoutPath( 'mod_menu', 'default_url' ); | |
| break; | |
| endswitch; | |
| // The next item is deeper. | |
| if ( $item->deeper ) { | |
| if ( $add_child == true ) { | |
| echo '<ul class="submenu menu vertical ' . $megachild . '" data-submenu>'; | |
| } | |
| } | |
| // The next item is shallower. | |
| elseif ( $item->shallower ) { | |
| echo '</li>'; | |
| echo str_repeat( '</ul></li>', $item->level_diff ); | |
| } | |
| // The next item is on the same level. | |
| else { | |
| //if (strpos($item->title,'col1') === false || (strpos($item->title,'rowend') !== false) || (strpos($item->title,'colend') !== false)) { | |
| if ( ( $item->anchor_css != 'off' ) && ( strpos( $item->title, 'col1' ) === false ) && ( strpos( $item->title, 'rowend' ) === false ) && ( strpos( $item->title, 'colend' ) === false ) ) { | |
| echo '</li>'; | |
| } | |
| } | |
| // same level close all 'off' | |
| if ( $item->anchor_css == 'off' ) { | |
| echo '</li>'; | |
| } | |
| endforeach; | |
| ?> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment