You are here

function admin_page_build in Admin 7.2

Preprocessor that runs *before* template_preprocess_page().

File

./admin.module, line 359

Code

function admin_page_build(&$page) {
  if (user_access('use admin toolbar') && ($trail = menu_get_active_trail())) {
    do {
      $last = array_pop($trail);
    } while (count($trail) && !($last['type'] & MENU_VISIBLE_IN_TREE));
    if ($last) {
      drupal_add_js(array(
        'activePath' => url($last['href']),
      ), array(
        'type' => 'setting',
        'scope' => JS_DEFAULT,
      ));
    }
  }
  if (!admin_suppress(FALSE) && ($blocks = admin_get_admin_blocks())) {
    $path = drupal_get_path('module', 'admin');
    drupal_add_js("misc/jquery.cookie.js");
    drupal_add_js("{$path}/includes/jquery.drilldown.js");
    drupal_add_js("{$path}/includes/admin.toolbar.js");
    drupal_add_js("{$path}/includes/admin.menu.js");
    drupal_add_css("{$path}/includes/admin.toolbar.base.css");
    drupal_add_css("{$path}/includes/admin.toolbar.css");
    drupal_add_css("{$path}/includes/admin.menu.css");
    $position = admin_get_settings('position');
    $layout = admin_get_settings('layout');
    $behavior = admin_get_settings('behavior');
    $class = admin_get_settings('expanded') ? 'admin-expanded' : '';
    $page['page_bottom']['admin_toolbar'] = array(
      '#type' => 'markup',
      '#markup' => theme('admin_toolbar', array(
        'blocks' => $blocks,
        'position' => $position,
        'layout' => $layout,
        'behavior' => $behavior,
      )),
    );
  }
}