You are here

function brightcove_init in Brightcove Video Connect 7.6

Same name and namespace in other branches
  1. 6.2 brightcove.module \brightcove_init()
  2. 6 brightcove.module \brightcove_init()
  3. 7.7 brightcove.module \brightcove_init()

Implements hook_init().

File

./brightcove.module, line 61
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_init() {
  $path = brightcove_get_experiences_js_url();
  drupal_add_js($path, [
    'type' => 'external',
    'defer' => FALSE,
    'async' => TRUE,
  ]);

  // Add Smart Player API related custom javascript, if it's necessary.
  if (variable_get('brightcove_player_smart_api', FALSE)) {
    drupal_add_js(drupal_get_path('module', 'brightcove') . '/js/events.js');
  }

  // Fix for AJAX fatal error.
  if ($_GET['q'] === 'system/ajax' && isset($_POST['form_id']) && $_POST['form_id'] === 'brightcove_video_form') {
    brightcove_load_lib();
  }
  _brightcove_configure_client();
}