You are here

function template_preprocess_advanced_help_popup in Advanced Help 7

Same name and namespace in other branches
  1. 6 advanced_help.module \template_preprocess_advanced_help_popup()

Fill in a bunch of page variables for our specialized popup page.

File

./advanced_help.module, line 1150
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function template_preprocess_advanced_help_popup(&$variables) {

  // Add favicon.
  if (theme_get_setting('toggle_favicon')) {
    drupal_add_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
  }
  global $theme;

  // Construct page title.
  if (drupal_get_title()) {
    $head_title = array(
      strip_tags(drupal_get_title()),
      variable_get('site_name', 'Drupal'),
    );
  }
  else {
    $head_title = array(
      variable_get('site_name', 'Drupal'),
    );
    if (variable_get('site_slogan', '')) {
      $head_title[] = variable_get('site_slogan', '');
    }
  }
  drupal_add_css(drupal_get_path('module', 'advanced_help') . '/help-popup.css');
  drupal_add_css(drupal_get_path('module', 'advanced_help') . '/help.css');
  $variables['head_title'] = implode(' | ', $head_title);
  $variables['base_path'] = base_path();
  $variables['front_page'] = url();
  $variables['breadcrumb'] = theme('breadcrumb', array(
    'breadcrumb' => drupal_get_breadcrumb(),
  ));
  $variables['feed_icons'] = drupal_get_feeds();
  $variables['head'] = drupal_get_html_head();
  $variables['language'] = $GLOBALS['language'];
  $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
  $variables['logo'] = theme_get_setting('logo');
  $variables['messages'] = theme('status_messages');
  $variables['site_name'] = theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '';
  $variables['css'] = drupal_add_css();
  $css = drupal_add_css();

  // Remove theme css.
  foreach ($css as $key => $value) {
    if ($value['group'] == CSS_THEME) {
      $exclude[$key] = FALSE;
    }
  }
  $css = array_diff_key($css, $exclude);
  $variables['styles'] = drupal_get_css($css);
  $variables['scripts'] = drupal_get_js();
  $variables['title'] = drupal_get_title();

  // This function can be called either with a render array or
  // an already rendered string.
  if (is_array($variables['content'])) {
    $variables['content'] = drupal_render($variables['content']);
  }

  // Closure should be filled last.
  // There has never been a theme hook for closure (going back to
  // first release 2008-04-17), so it is always 0 bytes.
  // Unable to figure out its purpose - commenting out.
  // $variables['closure'] = theme('closure');
}