1 admin_bar.inc admin_bar_links_page()

Build Page links.

See also

theme_admin_bar_links()

admin_bar_admin_bar_replacements()

File

core/modules/admin_bar/admin_bar.inc, line 669
Menu builder functions for Administration bar.

Code

function admin_bar_links_page() {
  $query = array('query' => array(
    'destination' => current_path(),
  ));

  $links['page'] = array(
    '#title' => theme('admin_bar_icon_page'),
    '#attributes' => array('class' => array('admin-bar-page-links')),
  );
  if (user_access('administer layouts')) {
    // Get the layout used by the current page/path.
    $layout = layout_get_layout_by_path();

    // We use 'page-layout' here for the array key as it get added to the link
    // as a class. A generic class like 'layout' would cause issues with the
    // Basis theme.
    $links['page']['page-layout'] = array(
      '#title' => t('Layout (@layout)', array('@layout' => $layout->title)),
      '#href' => 'admin/structure/layouts/manage/' . $layout->name,
      '#attributes' => array(
        'id' => array('admin-bar-page-layout'),
      ),
      '#options' => $query,
    );
    $links['page']['page-layout']['configure'] = array(
      '#title' => t('Configure'),
      '#href' => 'admin/structure/layouts/manage/' . $layout->name . '/configure',
      '#options' => $query,
    );
  }
  if (user_access('administer themes')) {
    // Get the theme used by the current page.
    global $theme;
    $theme_data = list_themes();
    $theme_object = $theme_data[$theme];

    $links['page']['page-theme'] = array(
      '#title' => t('Theme (@theme)', array('@theme' => $theme_object->info['name'])),
      '#href' => 'admin/appearance/settings/' . $theme_object->name,
      '#attributes' => array(
        'id' => array('admin-bar-page-theme'),
      ),
      '#options' => $query,
    );
  }

  // Don't display an empty menu.
  $page_links = element_children($links['page']);
  if (empty($page_links)) {
    return array();
  }

  return $links;
}