You are here

function video_embed_field_get_ajax_url in Video Embed Field 7.2

Generates the AJAX path array from the video URL and the video_style.

Parameters

string $video_url: The URL to the video.

string $video_style: The video style to render the video.

Return value

array The AJAX path array.

2 calls to video_embed_field_get_ajax_url()
theme_video_embed_field_colorbox_code in ./video_embed_field.module
Returns image style image with a link to an embedded video in colorbox.
video_embed_field_field_formatter_view in ./video_embed_field.field.inc
Implements hook_field_formatter_view().

File

./video_embed_field.module, line 537
Provides a simple field for easily embedding videos from youtube or vimeo

Code

function video_embed_field_get_ajax_url($video_url, $video_style) {
  $style = video_embed_field_video_style_load($video_style);

  // If there was an issue load in the default style.
  if ($style == FALSE) {
    $style = video_embed_field_video_style_load('normal');
  }
  $handler = video_embed_get_handler($video_url);
  $data = $style->data[$handler['name']];

  // Write values for later AJAX load.
  $hash = _video_embed_field_store_video($video_url, $video_style);
  return array(
    'path' => 'vef/load/' . $hash,
    'options' => array(
      'attributes' => array(
        'class' => array(
          'colorbox-load',
          'colorbox',
        ),
      ),
      'query' => array(
        'width' => $data['width'],
        'height' => $data['height'] + 5,
      ),
    ),
  );
}