You are here

function panels_everywhere_page_preprocess_elements in Panels Everywhere 6

Preprocess variables on our stripped down page template.

Since when we take over the page rendering mechanism, we cut core's page preprocessing out of the loop, we need to replace it with our own stripped down version to do just the minimum.

1 string reference to 'panels_everywhere_page_preprocess_elements'
panels_everywhere_theme_registry_alter in ./panels_everywhere.module
Implementation of hook_theme_registry_alter()

File

./panels_everywhere.module, line 271
panels_everywhere.module

Code

function panels_everywhere_page_preprocess_elements(&$variables) {

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

  // @todo add a settings form to control the following parts of this:
  // separator
  // use site name in title
  // use slogan in title
  // Construct page title
  $head_title = array();
  $page_title = drupal_get_title();
  if ($page_title) {
    $head_title[] = strip_tags($page_title);
  }

  // Optionally include the site name in the title.
  if (variable_get('panels_everywhere_head_title_include_name', TRUE)) {
    $site_name = variable_get('site_name', 'Drupal');
    if (!empty($site_name)) {
      $head_title[] = strip_tags(variable_get('site_name', 'Drupal'));
    }
  }

  // Optionally use the site's slogan if the page title is empty.
  if (empty($page_title) && variable_get('panels_everywhere_head_title_include_slogan', TRUE)) {
    $site_slogan = variable_get('site_slogan', '');
    if (!empty($site_slogan)) {
      $head_title[] = strip_tags($site_slogan);
    }
  }
  $variables['head_title'] = implode(variable_get('panels_everywhere_head_title_separator', ' | '), $head_title);
  $variables['base_path'] = base_path();
  $variables['front_page'] = url();
  $variables['head'] = drupal_get_html_head();
  $variables['css'] = drupal_add_css();
  $variables['styles'] = drupal_get_css();
  $variables['scripts'] = drupal_get_js();
  $variables['language'] = $GLOBALS['language'];
  $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';

  // Closure should be filled last.
  $variables['closure'] = theme('closure');
}