function toolbar_element_info

Implements hook_element_info().

File

drupal/core/modules/toolbar/toolbar.module, line 67
Administration toolbar for quick access to top level administration items.

Code

function toolbar_element_info() {
  $elements = array();
  $elements['toolbar'] = array(
    '#pre_render' => array(
      'toolbar_pre_render',
    ),
    '#theme' => 'toolbar',
    '#attached' => array(
      'library' => array(
        array(
          'toolbar',
          'toolbar',
        ),
      ),
    ),
    // Metadata for the toolbar wrapping element.
    '#attributes' => array(
      // The id cannot be simply "toolbar" or it will clash with the simpletest
      // tests listing which produces a checkbox with attribute id="toolbar"
      'id' => 'toolbar-administration',
      // The 'overlay-displace-top' class pushes the overlay down, so it appears
      // below the toolbar.
      'class' => array(
        'toolbar',
      ),
      'role' => 'navigation',
    ),
    // Metadata for the administration bar.
    '#bar' => array(
      '#heading' => t('Toolbar items'),
      '#attributes' => array(
        'id' => 'toolbar-bar',
        'class' => array(
          'bar',
          'clearfix',
        ),
        'data-offset-top' => array(),
      ),
    ),
  );

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