You are here

function fontyourface_add_css_in_preprocess in @font-your-face 7

Same name and namespace in other branches
  1. 6.2 fontyourface.module \fontyourface_add_css_in_preprocess()
  2. 6 fontyourface.module \fontyourface_add_css_in_preprocess()
  3. 7.2 fontyourface.module \fontyourface_add_css_in_preprocess()

Adds a stylesheet in preprocess

6 calls to fontyourface_add_css_in_preprocess()
fontdeck_preprocess_page in modules/fontdeck/fontdeck.module
Implements template_preprocess_page().
fontsquirrel_preprocess_page in modules/fontsquirrel/fontsquirrel.module
Implements template_preprocess_page().
fontyourface_preprocess_page in ./fontyourface.module
Implements template_preprocess_page().
google_fonts_api_preprocess_page in modules/google_fonts_api/google_fonts_api.module
Implements template_preprocess_page().
kernest_preprocess_page in modules/kernest/kernest.module
Implements template_preprocess_page().

... See full list

File

./fontyourface.module, line 820

Code

function fontyourface_add_css_in_preprocess(&$vars, $css_path, $type = 'public') {
  if ($type == 'remote') {
    drupal_add_css($css_path, array(
      'type' => 'external',
      'group' => CSS_THEME,
    ));
    $vars['styles'] = drupal_get_css();
  }
  else {
    if ($type == 'public') {
      $css_path = file_stream_wrapper_get_instance_by_scheme('public')
        ->getDirectoryPath() . '/' . $css_path;
    }

    // if
    drupal_add_css($css_path, array(
      'group' => CSS_THEME,
      'basename' => 'fontyourface-' . md5($css_path),
    ));
    $vars['styles'] = drupal_get_css();
  }

  // else
}