diff --git a/template.php b/template.php
index 65c1ded..e6ab94a 100644
--- a/template.php
+++ b/template.php
@@ -136,41 +136,50 @@ function zurb_foundation_field__taxonomy_term_reference($variables) {
}
/**
- * Implements theme_links() targeting the main menu specifically
- * Outputs Foundation Nav bar http://foundation.zurb.com/docs/navigation.php
- *
+ * Implements theme_menu_tree__MENU_NAME().
+ * @param $variables
+ * @return string
*/
-function zurb_foundation_links__system_main_menu($vars) {
- // Get all the main menu links
- $menu_links = menu_tree_output(menu_tree_all_data('main-menu'));
+function zurb_foundation_menu_tree__main_menu($variables) {
+ return '
' . $variables['tree'] . '
';
+}
- // Initialize some variables to prevent errors
- $output = '';
+/**
+ * Implements theme_menu_link().
+ * @param array $variables
+ * @return string
+ */
+function zurb_foundation_menu_link(array $variables) {
+ $element = $variables['element'];
$sub_menu = '';
+ $foundation_classes = array('active-trail', 'has-dropdown');
- foreach ($menu_links as $key => $link) {
- // Add special class needed for Foundation dropdown menu to work
- !empty($link['#below']) ? $link['#attributes']['class'][] = 'has-flyout' : '';
-
- // Render top level and make sure we have an actual link
- if (!empty($link['#href'])) {
- $output .= '
' . l($link['#title'], $link['#href']);
- // Get sub navigation links if they exist
- foreach ($link['#below'] as $key => $sub_link) {
- if (!empty($sub_link['#href'])) {
- $sub_menu .= '