You are here

function template_preprocess_video_insert_video in Insert Video 7

Theme the content that will be inserted for Video.

File

./insert_video.module, line 70
Insert support for Media module.

Code

function template_preprocess_video_insert_video(&$vars) {
  $vars['file'] = file_load($vars['item']['fid']);
  $formatter = insert_video_formatters($vars['style']['name']);
  $func = $formatter['view callback'];

  // Create an array of arguments to pass to the formatter's view hook.
  $args = array(
    'file' => $vars['file'],
    'display' => array(
      'settings' => $formatter['default settings'],
    ),
    'langcode' => NULL,
  );
  $vars['element'] = call_user_func_array($func, $args);
  $vars['video'] = render($vars['element']);
  $absolute = isset($vars['widget']['settings']['insert_absolute']) ? $vars['widget']['settings']['insert_absolute'] : NULL;
  $vars['url'] = file_create_url($vars['file']->uri, $absolute, variable_get('clean_url'));
  $vars['class'] = !empty($vars['widget']['settings']['insert_class']) ? $vars['widget']['settings']['insert_class'] : '';
}