You are here

function fontyourface_preprocess_html in @font-your-face 7.2

Same name and namespace in other branches
  1. 8.3 fontyourface.module \fontyourface_preprocess_html()

Implements template_preprocess_html().

1 call to fontyourface_preprocess_html()
fontyourface_ajax_render_alter in ./fontyourface.module
Implements hook_ajax_render_alter(). Adds CSS for fonts loaded via AJAX.

File

./fontyourface.module, line 158

Code

function fontyourface_preprocess_html(&$vars) {

  // Only load fonts when the default theme is loaded.
  if (!variable_get('fontyourface_load_everywhere', TRUE)) {
    global $theme;
    if ($theme != variable_get('theme_default', 'bartik')) {
      return;
    }
  }
  $fonts = fontyourface_font_registry() + fontyourface_get_fonts();
  $css = fontyourface_generate_css($fonts);
  $css_md5 = md5($css);
  if ($css_md5 != variable_get('fontyourface_css_md5', '')) {
    fontyourface_rewrite_css($css);
    variable_set('fontyourface_css_md5', $css_md5);
  }

  // if
  if ($css != '') {
    fontyourface_add_css_in_preprocess($vars, 'fontyourface/font.css');
  }

  // if
  $vars['fontyourface'] = $fonts;
}