You are here

function fontdeck_preprocess_page in @font-your-face 7

Same name and namespace in other branches
  1. 6.2 modules/fontdeck/fontdeck.module \fontdeck_preprocess_page()

Implements template_preprocess_page().

File

modules/fontdeck/fontdeck.module, line 151

Code

function fontdeck_preprocess_page(&$vars) {
  $project = variable_get('fontdeck_project', '');
  $domain = preg_replace('#^www.#', '', $_SERVER['HTTP_HOST']);
  if (!empty($vars['fontyourface']) && $project != '') {
    $enabled_fonts = FALSE;
    foreach ($vars['fontyourface'] as $used_font) {
      if ($used_font->provider == 'fontdeck') {
        $enabled_fonts = TRUE;
      }

      // if
    }

    // foreach
    if ($enabled_fonts) {
      $fontdeck_css = variable_get('fontdeck_css', array());
      if (isset($fontdeck_css[$project][$domain])) {
        fontyourface_add_css_in_preprocess($vars, $fontdeck_css[$project][$domain], 'remote');
      }

      // if
    }

    // if
  }

  // if
}