You are here

function osmplayer_add_core_files in MediaFront 7.2

Adds the core osmplayer static files to the page.

Parameters

type $params:

2 calls to osmplayer_add_core_files()
osmplayer_get_player in players/osmplayer/osmplayer.module
Implements hook_get_player()
osmplayer_media_colorbox_preprocess in players/osmplayer/osmplayer.module
Preprocess a colorbox to add a mediafront preset to it.

File

players/osmplayer/osmplayer.module, line 110

Code

function osmplayer_add_core_files(&$params) {

  // Get the player information.
  $info = osmplayer_get_info();

  // Add the theme information if provided.
  $themes = $info['themes'];
  if (!empty($themes[$params['theme']])) {
    $theme = $themes[$params['theme']];
    drupal_add_css($theme['url'], $theme['options']);
  }

  // Add the library.
  $library = 'osmplayer_' . $params['template'];
  $library .= $params['debug'] ? '_debug' : '';
  drupal_add_library('osmplayer', $library);

  // Add any additional resources.
  osmplayer_add_resources($info['resources']);

  // Iterate through our plugins.
  if (!empty($params['plugins'])) {
    foreach ($params['plugins'] as $name => &$plugin) {

      // Make sure this plugin is enabled.
      if (!empty($plugin) && !empty($info['plugins'][$name])) {

        // Add this plugins resources.
        osmplayer_add_resources($info['plugins'][$name]);

        // Make sure the params now pass the plugin object.
        $plugin = $name;
      }
      else {

        // Make sure this isn't added to the minplayer.
        unset($params['plugins'][$name]);
      }
    }
  }
}