You are here

function _video_embed_field_store_video in Video Embed Field 7.2

Stores a video to be loaded later from an _video_embed_field_load_video.

Parameters

string $video_url: The video URL.

string $video_style: The video style.

Return value

string The hash generated for the video URL and the given style.

1 call to _video_embed_field_store_video()
video_embed_field_get_ajax_url in ./video_embed_field.module
Generates the AJAX path array from the video URL and the video_style.

File

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

Code

function _video_embed_field_store_video($video_url, $video_style) {

  // Create a hash key.
  $hash = _video_embed_field_hash($video_url, $video_style);

  // Check that this record doesn't already exist before saving it.
  if (!_video_embed_field_load_video($hash)) {
    $record = array(
      'vhash' => $hash,
      'video_url' => $video_url,
      'video_style' => $video_style,
    );
    cache_set('vef-store-' . $hash, $record);

    // Add it to our static cache so we won't have to go to the database.
    $static_cache =& drupal_static('vef_video_store', array());
    $static_cache[$hash] = $record;
  }
  return $hash;
}