You are here

function video_view in Video 6

Same name and namespace in other branches
  1. 5 video.module \video_view()
  2. 6.2 video.module \video_view()

Implementation of hook_view().

File

./video.module, line 826
video.module

Code

function video_view(&$node, $teaser = FALSE, $page = FALSE) {

  // include the video css file
  drupal_add_css(drupal_get_path('module', 'video') . '/video.css');

  //Run the body through the standard filters.
  $node = node_prepare($node, $teaser);

  //print_r($node);

  //exit;

  // theme the teaser
  $node->teaser = theme('video_teaser', $node, $teaser, $page);

  // if we are viewing the page, run the body through the theme
  if ($page) {
    $output = '';
    if (user_access('play video')) {
      $node->content['video_player'] = array(
        '#value' => theme('video_player', $node),
        '#weight' => -1,
      );
    }
    else {
      $output .= l(t('login'), "user/login", array(
        'class' => 'outgoing',
        'title' => t('login to your account'),
      ));
      $output .= ' ' . t('or') . ' ';
      $output .= l(t('register'), "user/register", array(
        'class' => 'outgoing',
        'title' => t('create a new account'),
      ));
      $output .= ' ' . t('to play video');
      $node->content['video_player'] = array(
        '#value' => $output,
        '#weight' => -1,
      );
    }
  }
  return $node;
}