You are here

function video_file_browser in Video 7.2

video browser menu callback

1 string reference to 'video_file_browser'
video_menu in ./video.module
Implements hook_menu().

File

./video.pages.inc, line 38
This file stores all menu callbacks for the Video module

Code

function video_file_browser() {
  global $user;
  $output = array();

  // width and height of the player
  $output['video']['wxh'] = array(
    '#title' => t('Player dimensions'),
    '#type' => 'select',
    '#default_value' => '352x288',
    '#description' => t('Select the desired widthxheight of the video player. You can add your own dimensions from !settings.', array(
      '!settings' => l(t('Video module settings'), 'admin/config/media/video'),
    )),
    '#options' => video_utility::getDimensions(),
    '#attributes' => array(
      'class' => array(
        'video-file-browser-dimensions',
      ),
    ),
  );

  // field get instances
  $fields = field_info_instances();
  $node_field = array();
  foreach ($fields['node'] as $content_type => $fields) {
    foreach ($fields as $field_name => $field) {
      if ($field['widget']['type'] == 'video_upload') {
        $node_field[$content_type][$field_name] = $field;
      }
    }
  }
  foreach ($node_field as $content_type => $field) {
    $result = db_select('node', 'n')
      ->fields('n', array(
      'nid',
    ))
      ->condition('status', 0, '>')
      ->condition('type', $content_type)
      ->condition('uid', $user->uid)
      ->execute()
      ->fetchAll();
    foreach ($result as $value) {
      $node = node_load($value->nid);
      $node_view = node_view($node);
      foreach ($field as $field_name => $field_settings) {
        $item = $node_view[$field_settings['field_name']];
        $item[0]['#theme'] = 'video_formatter_thumbnail';
        $item[0]['#image_style'] = 'thumbnail';
        $item[0]['#path'] = '';
        $form = array();
        $form['video_browser']['image'] = array(
          '#prefix' => '<div class="video-item"><a href="#" ref="' . $node->nid . '">',
          '#markup' => '<div class="video-image">' . render($item[0]) . '</div>',
        );
        $form['video_browser']['title'] = array(
          '#markup' => '<div class="video-title">' . filter_xss($node->title) . '</div>',
        );
        $form['video_browser']['nid'] = array(
          '#type' => 'hidden',
          '#value' => $node->nid,
          '#suffix' => '</a></div>',
        );
        $output['video'][] = $form;
      }
    }
  }
  return render($output);
}