Commit 7b9addef authored by Pablo López's avatar Pablo López
Browse files

Issue #2504641 by emmonsaz, plopesc: Add iframe class support

parent 2b1b219e
Loading
Loading
Loading
Loading
+10 −1
Changes for video_embed_brightcove/video_embed_brightcove.module: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ function video_embed_brightcove_video_embed_handler_info() {
    'defaults' => array(
      'width' => 640,
      'height' => 360,
      'class' => '',
    ),
  );

@@ -57,6 +58,13 @@ function video_embed_brightcove_form($defaults) {
    '#default_value' => $defaults['height'],
  );

  $form['class'] = array(
    '#type' => 'textfield',
    '#title' => t('Player CSS class'),
    '#description' => t('CSS class to add to the player'),
    '#default_value' => $defaults['class'],
  );

  return $form;
}

@@ -83,7 +91,7 @@ function video_embed_brightcove_handle_video($url, $settings) {

  if (isset($parameters['id']) && isset($parameters['key'])) {
    // Embed code.
    $embed = '<object id="myExperience" class="BrightcoveExperience">
    $embed = '<object class="@class" id="myExperience" class="BrightcoveExperience">
      <param name="bgcolor" value="#FFFFFF" />
      <param name="width" value="@width" />
      <param name="height" value="@height" />
@@ -100,6 +108,7 @@ function video_embed_brightcove_handle_video($url, $settings) {
      '!key' => $parameters['key'],
      '@width' => $settings['width'],
      '@height' => $settings['height'],
      '@class' => $settings['class'],
      '!videoplayer' => $parameters['player'],
    ));

+10 −1
Changes for video_embed_facebook/video_embed_facebook.module: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ function video_embed_facebook_video_embed_handler_info() {
    'defaults' => array(
      'width' => 640,
      'height' => 360,
      'class' => '',
    ),
  );

@@ -57,6 +58,13 @@ function video_embed_facebook_form($defaults) {
    '#default_value' => $defaults['height'],
  );

  $form['class'] = array(
    '#type' => 'textfield',
    '#title' => t('Player CSS class'),
    '#description' => t('CSS class to add to the player'),
    '#default_value' => $defaults['class'],
  );

  return $form;
}

@@ -90,12 +98,13 @@ function video_embed_facebook_handle_video($url, $settings) {

  if ($id) {
    // Our embed code.
    $embed='<iframe src="//www.facebook.com/video/embed?video_id=!id" width="@width" height="@height"></iframe> ';
    $embed='<iframe class="@class" src="//www.facebook.com/video/embed?video_id=!id" width="@width" height="@height"></iframe> ';
    // Use format_string to replace our placeholders with the settings values.
    $embed = format_string($embed, array(
      '!id' => $id,
      '@width' => $settings['width'],
      '@height' => $settings['height'],
      '@class' => $settings['class'],
    ));

    $video = array(
+27 −2
Changes for video_embed_field.handlers.inc: 27 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ function video_embed_field_video_embed_handler_info() {
      'modestbranding' => 0,
      'theme' => 'dark',
      'iv_load_policy' => 1,
      'class' => '',
    ),
  );

@@ -61,6 +62,7 @@ function video_embed_field_video_embed_handler_info() {
      'autoplay' => 0,
      'loop' => 0,
      'froogaloop' => 0,
      'class' => ''
    ),
  );

@@ -185,11 +187,16 @@ function video_embed_field_handle_youtube($url, $settings) {
    $output['#markup'] = l($url, $url);
    return $output;
  }
  
  // Add class to variable to avoid adding it to URL param string.
  $class = $settings['class'];
  unset($settings['class']);

  // Construct the embed code.
  $settings['wmode'] = 'opaque';
  $settings_str = _video_embed_code_get_settings_str($settings);

  $output['#markup'] = '<iframe width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//www.youtube.com/embed/' . $id . '?' . $settings_str . '" frameborder="0" allowfullscreen></iframe>';
  $output['#markup'] = '<iframe class="' . check_plain($class) . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//www.youtube.com/embed/' . $id . '?' . $settings_str . '" frameborder="0" allowfullscreen></iframe>';

  return $output;
}
@@ -406,6 +413,13 @@ function video_embed_field_handler_youtube_form($defaults) {
    '#default_value' => $defaults['autohide'],
  );

  $form['class'] = array(
    '#type' => 'textfield',
    '#title' => t('Player CSS class'),
    '#description' => t('CSS class to add to the player'),
    '#default_value' => $defaults['class'],
  );

  return $form;
}

@@ -494,10 +508,14 @@ function video_embed_field_handle_vimeo($url, $settings) {
  }
  unset($settings['froogaloop']);

  // Add class to variable to avoid adding it to URL param string.
  $class = $settings['class'];
  unset($settings['class']);

  $settings_str = _video_embed_code_get_settings_str($settings);

  return array(
    '#markup' => '<iframe id="' . $settings['player_id'] . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//player.vimeo.com/video/' . $id .
    '#markup' => '<iframe class="' . check_plain($class) . '" id="' . $settings['player_id'] . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//player.vimeo.com/video/' . $id .
    '?' . $settings_str . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
  );
}
@@ -621,6 +639,13 @@ function video_embed_field_handler_vimeo_form($defaults) {
    '#default_value' => $defaults['loop'],
  );

  $form['class'] = array(
    '#type' => 'textfield',
    '#title' => t('Player CSS class'),
    '#description' => t('CSS class to add to the player'),
    '#default_value' => $defaults['class'],
  );

  return $form;
}