You are here

function swftools_form_swftools_admin_handling_form_alter in SWF Tools 6.3

Implementation of hook_form_FORM_ID_alter().

Alters the SWF Tools file handling form to include an upload integration section.

File

upload/swftools_upload.module, line 51
Enables simple integration of SWF Tools with the upload module.

Code

function swftools_form_swftools_admin_handling_form_alter(&$form, &$form_state) {
  $form['swftools_upload'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Upload integration'),
    '#description' => t('SWF Tools provides simple integration with the upload module. This only offers very limited functionality and is provided primarily for backward compatability with Drupal 5 sites. CCK integration provides much more flexibility and should be used for new installations.'),
  );
  $form['swftools_upload']['swftools_upload_integration'] = array(
    '#type' => 'radios',
    '#title' => t('Upload integration'),
    '#default_value' => variable_get('swftools_upload_integration', 0),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#description' => t('When enabled all nodes will run through the SWF Tools integration module and any files will be converted to a media player or playlist.'),
  );

  // Convert extensions back from array to string
  $extensions = variable_get('swftools_upload_extensions', array(
    'swf',
    'mp3',
    'flv',
  ));
  $extensions = implode(' ', $extensions);
  $form['swftools_upload']['swftools_upload_extensions'] = array(
    '#type' => 'textarea',
    '#title' => t('Integrate extensions'),
    '#default_value' => $extensions,
    '#description' => t('Enter a list of extensions that should be processed by SWF Tools. When an extension is in this list all files with that extension will be processed. It is not possible to selectively apply the integration.'),
  );

  // Attach custom submit handler
  $form['#submit'] = array_merge(array(
    'swftools_admin_upload_integration_submit',
  ), $form['#submit']);

  // Put buttons back in the right place
  $temp = $form['buttons'];
  unset($form['buttons']);
  $form['buttons'] = $temp;
}