Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 36 lines (33 sloc) 1.159 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
<?php
/**
* foundation-walker.php
*
* Description of the purpose of this file
*
* @package Project name
* @since Version number
* @link http://github.com/pdewouters/repository
* @author Paul de Wouters
* @copyright Copyright (c) 2012, Paul de Wouters
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/

class Foundation_Walker extends Walker_Nav_Menu{
// add classes to ul sub-menus
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"dropdown\">\n";
}

function end_el( &$output, $item, $depth = 0, $args = array() ) {
if($depth == 0)
$output .= "</li>\n<li class=\"divider\"></li>\n";
else
$output .= "</li>\n";
}

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);
}
}
Something went wrong with that request. Please try again.