You are here

function template_preprocess_securesite_page in Secure Site 8

Same name and namespace in other branches
  1. 7.2 theme/securesite.theme.inc \template_preprocess_securesite_page()

Process variables for securesite-page.html.twig

Parameters

$variables: An array of variables from the theme system.

File

theme/securesite.theme.inc, line 48
Theme functions.

Code

function template_preprocess_securesite_page(&$variables) {

  // Add relevant default variables, taken from template_preprocess_page()
  $variables['messages'] = !empty($variables['show_messages']) ? _theme('status_messages') : '';
  $variables['base_path'] = base_path();
  $variables['logo'] = theme_get_setting('logo')['url'];
  $variables['front_page'] = url();

  // Check if logo exists before output it in a template file
  // First get relative path from logo theme setting
  $logo_parts = parse_url($variables['logo']);
  $logo_path = $logo_parts['path'];
  if (strpos($logo_path, $variables['base_path']) === 0) {
    $logo_path = substr($logo_path, strlen($variables['base_path']));
  }

  // If file does not exist clear it
  if (!file_exists($logo_path)) {
    $variables['logo'] = NULL;
  }

  // Clear out existing CSS
  $css =& drupal_static('_drupal_add_css', array());
  $css = array();

  // Add our css file back, so it will be the only one
  _drupal_add_css(drupal_get_path('module', 'securesite') . '/theme/securesite.css');

  // By default a lot unnecessary JS is load,
  // By default we should not need any JS.
  $js =& drupal_static('_drupal_add_js', array());
  $js = array();

  // Required by Core template_process_html()
  $variables['page_object'] = new HtmlPage();

  // Call Drupal core default html page preprocess function
  template_preprocess_html($variables);
}