You are here

function html_title_preprocess_page in HTML Title 6

Same name and namespace in other branches
  1. 7 html_title.module \html_title_preprocess_page()

Implementation of hook_preprocess_page()

File

./html_title.module, line 48
This module enables limited HTML to be used in node titles. It strips title markup from RSS feeds to eliminate unsightly markup in feed readers.

Code

function html_title_preprocess_page(&$vars) {
  if (array_key_exists('node', $vars)) {
    $elements = variable_get('html_title_allowed_elements', array(
      'em',
      'sub',
      'sup',
    ));

    // Reset title to allow safe HTML
    $vars['title'] = filter_xss($vars['node']->title, $elements);

    // Strip HTML from head title
    $vars['head_title'] = strip_tags($vars['node']->title);
    drupal_set_title($vars['head_title']);
  }
}