You are here

function scald_admin_type_form in Scald: Media Management made easy 7

Form for admin settings for Scald Types.

1 string reference to 'scald_admin_type_form'
scald_menu in ./scald.module
Implements hook_menu().

File

includes/scald.admin.inc, line 110

Code

function scald_admin_type_form($form, $form_state, $type) {
  $form = array();
  $type_name = $type->type;
  $type_raw = (array) $type;
  $form['type_' . $type_name . '_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => $type_raw['title'],
    '#size' => 40,
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $default = scald_atom_defaults($type_name);
  $form['defaults'] = array(
    '#type' => 'fieldset',
    '#title' => t('Defaults'),
    '#description' => t('Every Atom must have certain data associated with it.  If an Atom Provider fails to supply that data, these defaults are used.  If nothing is specified here, Scald Core will supply generic defaults.'),
    '#collapsible' => FALSE,
  );
  $form['defaults']['type_' . $type_name . '_thumb'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Thumbnail Image'),
    '#description' => t('Specify a path relative to the Drupal install directory.  This image file will be automatically resized and transcoded as appropriate when generating the actual thumbnail image.'),
    '#default_value' => $default->thumbnail_source,
    '#size' => 40,
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $form['defaults']['type_' . $type_name . '_descr'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Description'),
    '#description' => t('Empty strings are permitted.'),
    '#default_value' => $default->description,
    '#size' => 40,
    '#maxlength' => 255,
  );
  $options = array(
    'managed_file' => t('Managed file'),
  );
  if (module_exists('plupload')) {
    $options['plupload'] = t('Plupload');
  }
  $form['defaults']['type_' . $type_name . '_utype'] = array(
    '#type' => 'select',
    '#title' => t('Upload type'),
    '#default_value' => $default->upload_type,
    '#options' => $options,
  );

  // Create checkboxes for the defined actions.
  $actions = scald_actions();
  $options = array();
  $options_default = array();
  foreach ($actions as $name => $action) {
    $options[$name] = $action['title'];
    $options_default[$name] = $default->actions & $action['bitmask'] ? $name : '';
  }
  $form['defaults']['type_' . $type_name . '_actin'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Default Actions'),
    '#description' => t('Please select the actions that should be enabled by default for atom of this type. Note that the actions you choose here are the one that you want to be made available on this atom to everyone ; the actions that the atom author can perform can be configured per role using standard Drupal rights.'),
    '#options' => $options,
    '#default_value' => $options_default,
    '#required' => TRUE,
  );
  $form['atom_type'] = array(
    '#type' => 'value',
    '#value' => $type_name,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}