You are here

function video_preset_form in Video 7

Same name and namespace in other branches
  1. 7.2 modules/video_ui/video.preset.inc \video_preset_form()

Preset form

_state

Parameters

<type> $form:

<type> $preset:

Return value

string

1 string reference to 'video_preset_form'
video_ui_menu in modules/video_ui/video_ui.module
Implementation of hook_menu().

File

modules/video_ui/video.preset.inc, line 384

Code

function video_preset_form($form, &$form_state, $preset = FALSE) {
  $form = array();

  // basic preset details
  $form['preset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Preset information'),
    '#weight' => -10,
  );
  if (isset($preset['pid'])) {
    $form['preset']['pid'] = array(
      '#type' => 'value',
      '#value' => $preset['pid'],
    );
  }
  elseif (video_is_default_preset($preset['name'])) {
    $form['preset']['default'] = array(
      '#type' => 'value',
      '#value' => TRUE,
    );
  }
  $form['preset']['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Preset name'),
    '#maxlength' => VIDEO_PRESET_MAX_LENGTH,
    '#description' => t('Spaces are NOT allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.'),
    '#required' => TRUE,
    '#weight' => -10,
    '#element_validate' => array(
      '_video_preset_name_validate',
    ),
    '#default_value' => !empty($preset['name']) ? $preset['name'] : '',
  );
  $form['preset']['description'] = array(
    '#type' => 'textfield',
    '#title' => t('Description'),
    '#description' => t('Add a brief description to your preset name.'),
    '#weight' => -9,
    '#default_value' => !empty($preset['description']) ? $preset['description'] : '',
  );

  // Preset settings
  $form += video_preset_default_form($form, $form_state, $preset);

  // Buttons
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Preset'),
    '#weight' => 30,
  );
  $form['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#weight' => 40,
    '#submit' => array(
      'video_preset_delete_submit',
    ),
  );

  // Add the form submit handler.
  $form['#submit'][] = 'video_preset_submit';
  $form['#validate'][] = 'video_preset_validate';
  return $form;
}