You are here

function scald_admin_types_form in Scald: Media Management made easy 6

Form for admin settings for Scald Types

1 string reference to 'scald_admin_types_form'
scald_admin_types in ./scald.admin.inc
The Scald Admin page for Scald Unified Types.

File

./scald.admin.inc, line 83

Code

function scald_admin_types_form() {
  $form = array();
  $types_results = db_query("\n    SELECT\n      *\n    FROM\n      {scald_types}\n  ");
  while ($type_raw = db_fetch_array($types_results)) {
    $form[$type_raw['type']] = array(
      '#type' => 'fieldset',
      '#title' => check_plain($type_raw['title']),
      '#description' => $type_raw['description'] . '<br>' . t('Provided by <code>@module.module</code>', array(
        '@module' => $type_raw['provider'],
      )),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form[$type_raw['type']]['type_' . $type_raw['type'] . '_title'] = array(
      '#type' => 'textfield',
      '#title' => t('Title'),
      '#default_value' => $type_raw['title'],
      '#size' => 40,
      '#maxlength' => 255,
      '#required' => TRUE,
    );
    $scald_config = variable_get('scald_config', 0);
    $scald_atom_defaults = variable_get('scald_atom_defaults', 0);
    $form[$type_raw['type']]['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[$type_raw['type']]['defaults']['type_' . $type_raw['type'] . '_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' => $scald_atom_defaults->thumbnail_source[$type_raw['type']],
      '#size' => 40,
      '#maxlength' => 255,
      '#required' => TRUE,
    );
    $form[$type_raw['type']]['defaults']['type_' . $type_raw['type'] . '_descr'] = array(
      '#type' => 'textfield',
      '#title' => t('Default Description'),
      '#description' => t('Empty strings are permitted.'),
      '#default_value' => $scald_atom_defaults->description[$type_raw['type']],
      '#size' => 40,
      '#maxlength' => 255,
      '#required' => TRUE,
    );

    // @@@TODO: Make this into a *useful* UI!
    $form[$type_raw['type']]['defaults']['type_' . $type_raw['type'] . '_actin'] = array(
      '#type' => 'textfield',
      '#title' => t('Default Actions bitstring'),
      '#description' => t('Should be an integer.  Note that the numbering on the Actions Admin page does not correspond to bit order.'),
      '#default_value' => $scald_atom_defaults->actions[$type_raw['type']],
      '#size' => 10,
      '#maxlength' => 24,
      '#required' => TRUE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}