Skip to content

Instantly share code, notes, and snippets.

@willaalt
Created May 9, 2016 17:01
Show Gist options
  • Select an option

  • Save willaalt/e52e1b6b14a03467bba764530522b00d to your computer and use it in GitHub Desktop.

Select an option

Save willaalt/e52e1b6b14a03467bba764530522b00d to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* Contains a pre-process hook for 'html'.
*/
/**
* Implements hook_preprocess_html().
*/
function nb_omega_preprocess_html(&$variables, $hook) {
$product = nbbase_get_query(NBBASE_PARAM_PRODUCT, '');
$product_name = NULL;
// Check if product exists and if product info is set
if (user_is_logged_in() && !empty($product)) {
$product_info = nbbase_get_current_product_info();
if (isset($product_info)) {
$product_name = $product_info->name;
}
}
// Display title | product name | site name
// if not then title | site name
if (!empty($product_name)) {
$variables['head_title'] = implode(' | ', array(drupal_get_title(), $product_name, variable_get('site_name')));
} else {
$variables['head_title'] = implode(' | ', array(drupal_get_title(), variable_get('site_name')));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment