You are here

function _video_embed_field_load_video in Video Embed Field 7.2

Loads a video from the video store given its hash.

Parameters

string $hash: The video hash.

Return value

array|bool An array with video definition, FALSE if the hash does not exist.

2 calls to _video_embed_field_load_video()
_video_embed_field_show_video in ./video_embed_field.module
Renders a video for an AJAX call.
_video_embed_field_store_video in ./video_embed_field.module
Stores a video to be loaded later from an _video_embed_field_load_video.

File

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

Code

function _video_embed_field_load_video($hash) {
  $static_cache =& drupal_static('vef_video_store', array());

  // Check if we've already loaded it.
  if (isset($static_cache[$hash])) {
    return $static_cache[$hash];
  }
  else {
    $result = cache_get('vef-store-' . $hash);
    if ($result) {

      // Cache it before returning.
      $data = $result->data;
      $static_cache[$hash] = $data;
      return $data;
    }
    else {
      return FALSE;
    }
  }
}