You are here

function navbar_element_info in Navbar 7

Implements hook_element_info().

File

./navbar.module, line 123
Administration navbar for quick access to top level administration items.

Code

function navbar_element_info() {
  $elements = array();
  $elements['navbar'] = array(
    '#pre_render' => array(
      'navbar_pre_render',
    ),
    '#theme' => 'navbar',
    '#attached' => array(
      'library' => array(
        array(
          'navbar',
          'navbar',
        ),
      ),
    ),
    // Metadata for the navbar wrapping element.
    '#attributes' => array(
      // The id cannot be simply "navbar" or it will clash with the simpletest
      // tests listing which produces a checkbox with attribute id="navbar"
      'id' => 'navbar-administration',
      // The 'overlay-displace-top' class is necessary in overlay-parent so that
      // the drupalOverlayResize and drupalOverlayClose events will be bound
      // to the document. The navbar does not use this class. It is present
      // to enable compatibility with the Overlay module.
      'class' => array(
        'drupal-navbar',
        'overlay-displace-top',
      ),
      'role' => 'navigation',
    ),
    // Metadata for the administration bar.
    '#bar' => array(
      '#heading' => t('Navbar items'),
      '#attributes' => array(
        'id' => 'navbar-bar',
        'class' => array(
          'navbar-bar',
          'clearfix',
        ),
      ),
    ),
  );

  // A navbar item is wrapped in markup for common styling.  The 'tray'
  // property contains a renderable array. theme_navbar_tab() is a light
  // wrapper around the l() function. The contents of tray are rendered in
  // theme_navbar_tab().
  $elements['navbar_item'] = array(
    '#pre_render' => array(
      'navbar_pre_render_item',
    ),
    '#theme' => 'navbar_item',
    '#theme_wrappers' => array(
      'navbar_tab_wrapper',
    ),
    'tab' => array(
      '#type' => 'link',
      '#title' => NULL,
      '#href' => '',
    ),
  );
  return $elements;
}