You are here

function video_types_page in Video 6

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

Display a video types selection page

1 call to video_types_page()
video_add in ./video.module
Create video submission page. Let the user select the actived video types or display the video form for the selected video type

File

./video.module, line 524
video.module

Code

function video_types_page() {
  drupal_set_title(t('Submit Video'));

  // we have to set a titl ebecause the node module will not do it for us as we are using a callback video_add()
  $vtypes = video_get_types_infos();
  if (!$vtypes) {

    // no vtype available
    return t('There are no Video types enabled.');
  }
  else {
    $items = array();
    foreach ($vtypes as $vtype => $infos) {
      $out = '<dt>' . l($infos['#name'], "node/add/video/{$vtype}", array(
        'HTML' => TRUE,
        'attributes' => array(
          'title' => 'Add a ' . $infos['#name'],
        ),
      )) . '</dt>';
      $out .= '<dd>' . $infos['#description'] . '</dd>';
      $items[$vtype] = $out;
    }

    // let's order by type name
    ksort($items);
    return t('Choose from the following available video types:') . '<dl>' . implode('', $items) . '</dl>';
  }
}