You are here

function video_embed_field_filter_process in Video Embed Field 7.2

Same name and namespace in other branches
  1. 7 video_embed_field.module \video_embed_field_filter_process()

Video Embed Field filter process callback.

1 string reference to 'video_embed_field_filter_process'
video_embed_field_filter_info in ./video_embed_field.module
Implements hook_filter_info().

File

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

Code

function video_embed_field_filter_process($text, $filter, $format) {
  preg_match_all('/ \\[VIDEO:: ( [^\\[\\]]+ )* \\] /x', $text, $matches);
  $tag_match = (array) array_unique($matches[1]);
  foreach ($tag_match as $tag) {
    $parts = explode('::', $tag);

    // Get video style.
    if (isset($parts[1])) {
      $style = $parts[1];
    }
    else {
      $style = 'normal';
    }
    $embed_code = theme('video_embed_field_embed_code', array(
      'url' => $parts[0],
      'style' => $style,
    ));
    $text = str_replace('[VIDEO::' . $tag . ']', $embed_code, $text);
  }
  return $text;
}