You are here

function acquia_lift_navbar in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \acquia_lift_navbar()

Implements hook_navbar().

1 call to acquia_lift_navbar()
acquia_lift_navbar_ui_pre_render in ./acquia_lift.ui.inc
Builds the unified navbar as a structured array ready for drupal_render().
1 string reference to 'acquia_lift_navbar'
_acquia_lift_navigation_attach_assets in ./acquia_lift.module
Create and attach the assets for Acquia Lift navigation to an element on the page.

File

./acquia_lift.module, line 2288
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function acquia_lift_navbar() {
  $items = array();
  $menu = menu_tree_all_data('acquia-lift-controls');
  $usingUnifiedNavbar = _acquia_lift_using_unified_navbar();
  if (!empty($menu)) {
    $items['acquia_lift'] = array(
      '#access' => user_access('manage personalized content'),
      '#type' => $usingUnifiedNavbar ? 'acquia_lift_navbar_item' : 'navbar_item',
      'tray' => array(
        '#heading' => t('Personalization controls'),
        'navbar_personalization' => array(
          '#type' => 'container',
          '#attributes' => array(
            'class' => array(
              'navbar-menu-acquia-lift-controls',
              'acquia-lift-controls',
            ),
          ),
          'personalization' => menu_tree_output($menu),
        ),
        '#wrapper_attributes' => array(
          'class' => array(
            'navbar-tray-acquia-lift',
          ),
        ),
      ),
      '#weight' => 20,
    );
    if (!$usingUnifiedNavbar) {

      // Add the tab trigger for the tray.
      $items['acquia_lift']['tab'] = array(
        '#type' => 'link',
        '#title' => t('Acquia Lift'),
        '#href' => 'admin/structure/personalize',
        '#options' => array(
          'attributes' => array(
            'title' => t('Personalization settings'),
            // @todo, the .navbar-tab class is provided here because Demo
            // Framework is on an older version of Navbar (dd542e1). Once
            // DF is updated to the latest Navbar release, the .navbar-tab
            // class can be removed here. The class should be added in
            // template_preprocess_navbar_tab_wrapper, which only add a class
            // .tab in older versions.
            'class' => array(
              'navbar-icon',
              'navbar-icon-acquia-lift',
              'navbar-tab',
            ),
          ),
        ),
      );

      // Add the library for the navbar integration.
      $items['acquia_lift']['#attached'] = array(
        'library' => array(
          array(
            'acquia_lift',
            'acquia_lift.navbar',
          ),
        ),
      );
    }
  }
  return $items;
}