You are here

function asset_wizard_format_options_form in Asset 6

Same name and namespace in other branches
  1. 5.2 asset_wizard.module \asset_wizard_format_options_form()

Form Builder for Step 3

1 string reference to 'asset_wizard_format_options_form'
asset_wizard_format_options in ./asset_wizard.module
Step 3: Display the options form

File

./asset_wizard.module, line 481
Wizard-style interface for Asset.

Code

function asset_wizard_format_options_form($asset, $attr) {
  $format = $asset->formatters[$attr['format']];
  $options = module_invoke($format->module, 'asset_formatter', 'form', $asset, $attr);
  if (!$options) {
    $macro = asset_build_macro(array(
      'aid' => $asset->aid,
      'format' => $format->format,
    ));
    drupal_goto('asset/wizard/' . $asset->aid . '/finish/' . $macro);
  }
  $form = array();
  $form['options'] = $options;
  $form['options']['#tree'] = TRUE;
  $form['options']['aid'] = array(
    '#type' => 'value',
    '#value' => $asset->aid,
  );
  $form['options']['format'] = array(
    '#type' => 'value',
    '#value' => $format->format,
  );
  $form['buttons'] = array(
    '#tree' => FALSE,
    '#theme' => 'asset_wizard_form_buttons',
  );
  $form['buttons'][] = array(
    '#type' => 'submit',
    '#value' => t('Preview'),
  );
  $form['#type'] = 'form';
  if ($_GET['return']) {
    $form['#action'] = url($_GET['q'], 'return=' . $_GET['return']);
  }
  return $form;
}