You are here

function theme_uikit_navbar in UIkit Components 7

Same name and namespace in other branches
  1. 7.3 uikit_components.module \theme_uikit_navbar()
  2. 7.2 uikit_components.module \theme_uikit_navbar()

File

./uikit_components.module, line 83
UIkit Components.

Code

function theme_uikit_navbar($variables) {
  $menus = $variables['menus'];
  $menus_flipped = $variables['menus_flipped'];
  $attributes['class'][] = 'uk-navbar';
  if ($variables['attached']) {
    $attributes['class'][] = 'uk-navbar-attached';
  }
  $output = '';
  if (!empty($menus) || !empty($menus_flipped)) {

    // Navbar wrapper.
    $output = '<nav' . drupal_attributes($attributes) . '>';
    if (!empty($menus)) {
      foreach ($menus as $menu) {

        // Render menu trees for each menu.
        $menu_tree = menu_tree($menu);
        $menu_tree['#theme_wrappers'] = array(
          'menu_tree__navbar',
        );
        $output .= render($menu_tree);
      }
    }
    if (!empty($menus_flipped)) {
      foreach ($menus_flipped as $menu_flip) {

        // Render menu trees for each flipped menu.
        $menu_tree_flip = menu_tree($menu_flip);
        $menu_tree_flip['#theme_wrappers'] = array(
          'menu_tree__navbar_flip',
        );
        $output .= render($menu_tree_flip);
      }
    }
    $output .= '</nav>';
  }
  return $output;
}