You are here

function video_multidownload_form_alter in Video 6

Same name and namespace in other branches
  1. 5 plugins/video_multidownload/video_multidownload.module \video_multidownload_form_alter()
  2. 6.2 plugins/video_multidownload/video_multidownload.module \video_multidownload_form_alter()

Implementation of hook_form_alter() We use this to add multidownload fields to the video creation form.

File

plugins/video_multidownload/video_multidownload.module, line 124
Enable multiple file download in video module.

Code

function video_multidownload_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'video_node_form' && isset($form['video']) && user_access('create multi-file downloads')) {
    $node = $form['#node'];
    $form['multi-file'] = array(
      '#type' => 'fieldset',
      '#title' => t('Multiple files in download tab'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => -18,
      '#description' => t('These options allow you to have multiple files shown on the download page. This is useful for allowing users to download different file sizes and video formats. ') . l(t('More information.'), 'video/help', array(
        'fragment' => 'multi-download',
      )),
    );
    $form['multi-file']['disable_multidownload'] = array(
      '#type' => 'checkbox',
      '#title' => t('Disable multi-file downloads'),
      '#default_value' => isset($node->disable_multidownload) ? $node->disable_multidownload : 1,
      '#description' => t('Disables multi-file downloads for this video only.'),
    );
    $form['multi-file']['download_folder'] = array(
      '#type' => 'textfield',
      '#title' => t('Multi-file download folder'),
      '#default_value' => $node->download_folder,
      '#maxlength' => 250,
      '#description' => t('Enter the folder containing your videos. It must be relative from the drupal directory. If the absolute path is "C:\\inetpub\\drupal\\videos\\projectfolder\\" or "/usr/htdocs/drupal/videos/projectfolder/" then enter something like "videos/projectfolder/".'),
    );
    $form['multi-file']['use_play_folder'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show files in "play" folder'),
      '#default_value' => $node->use_play_folder,
      '#description' => t('Display videos in the same directory as the "play" video. If folder above is entered this will be in addition.'),
    );
  }
}