You are here

function osmplayer_add_css in MediaFront 7

Same name and namespace in other branches
  1. 6.2 players/osmplayer/osmplayer.module \osmplayer_add_css()
  2. 6 players/osmplayer/osmplayer.module \osmplayer_add_css()

Helper function to add all the osmplayer CSS files.

1 call to osmplayer_add_css()
template_preprocess_osmplayer in players/osmplayer/osmplayer.module
The template preprocess function for the osm media player.

File

players/osmplayer/osmplayer.module, line 684

Code

function osmplayer_add_css($player, $preset) {
  static $cssadded;
  if (!isset($cssadded[$preset])) {
    $cssadded[$preset] = TRUE;

    // Get the CSS files.
    $css_files = $player->template
      ->getCSSFiles();
    if ($player->template->settings['generateCSS']) {

      // If themeroller is enabled, then we will want to make sure
      // to set the CSS directory of our cached directory instead of the
      // default REAL path.
      $files_dir = variable_get('file_public_path', conf_path() . '/files');
      $css_dir = $files_dir . '/css/osmplayer';
      $player->template
        ->setCSSDir(getcwd() . '/' . $css_dir);
    }
    else {

      // Otherwise, just get the path to the player folder.
      $css_dir = osmplayer_get_path();
      if (isset($css_files['theme'])) {
        drupal_add_css($css_dir . '/' . $css_files['theme']);
      }
    }
    if (isset($css_files['template'])) {
      drupal_add_css($css_dir . '/' . $css_files['template']);
    }
    if (isset($css_files['template_ie']) && $css_files['template_ie']) {
      drupal_add_html_head('<!--[if IE]><link rel="stylesheet" type="text/css" href="' . ($css_dir . '/' . $css_files['template_ie']) . '" /><![endif]-->');
    }
  }
}