You are here

function theme_brightcove_field_formatter_iframe in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove_field.formatters.inc \theme_brightcove_field_formatter_iframe()

File

./brightcove_field.formatters.inc, line 42
Formatters for video field.

Code

function theme_brightcove_field_formatter_iframe($variables) {
  $output = NULL;
  if (isset($variables['element']['brightcove_id'])) {
    $vidcount =& drupal_static(__FUNCTION__, 1);
    if ($vidcount == 1) {
      $path = brightcove_get_experiences_js_url();
      drupal_add_js($path, [
        'type' => 'external',
        'defer' => FALSE,
        'async' => TRUE,
      ]);
    }
    $client = brightcove_client_load_or_default($variables['element']['bcid']);
    $output = theme('brightcove_field_embed_iframe', [
      'iframe_url' => brightcove_embed_iframe_url($client->account_id, $variables['element']['player'] ?: brightcove_get_default_player($client->bcid), $variables['element']['embed'] ?: 'default', $variables['element']['brightcove_id'], $variables['type']),
    ]);
    $vidcount++;
  }
  return $output;
}