You are here

function video_admin_preset_configure in Video 6.5

Form for transcoder specific preset settings

1 string reference to 'video_admin_preset_configure'
video_menu in ./video.module
Implementation of hook_menu().

File

./video.admin.inc, line 380

Code

function video_admin_preset_configure(&$form_state, video_preset $preset) {
  $transcoder = video_get_transcoder();
  $presetform = $transcoder
    ->preset_settings($form_state, $preset);
  $form_state['preset'] = $preset;
  $form_state['transcoder'] = $transcoder;

  // Save the settings keys that are saved to the database later
  $form_state['keys'] = array();
  foreach (element_children($presetform) as $child) {
    $type = '';
    if (isset($presetform[$child]['#type'])) {
      $type = $presetform[$child]['#type'];
    }
    if ($type != 'item' && $type != 'value' && $type != 'markup') {
      $form_state['keys'][] = $child;
    }
  }
  $form = array(
    '#redirect' => 'admin/settings/video/presets',
  );
  $form['preset'] = array(
    '#type' => 'item',
    '#title' => t('Preset'),
    '#value' => check_plain($preset->name) . ' (' . t('extension:') . ' ' . $preset->extension . ')',
  );
  $form['transcoder'] = array(
    '#type' => 'item',
    '#title' => t('Transcoder'),
    '#value' => check_plain($transcoder
      ->get_name()),
  );
  if (!empty($form_state['keys'])) {
    $form = array_merge($form, $presetform);
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
      '#suffix' => l(t('Back'), $form['#redirect']),
    );
  }
  else {
    $form['notice'] = array(
      '#type' => 'item',
      '#value' => t('This transcoder does not have specific settings for this preset.'),
      '#suffix' => l(t('Back'), $form['#redirect']),
    );
  }
  return $form;
}