You are here

function filefield_field_settings_form in FileField 6.3

Implementation of CCK's hook_field_settings($op = 'form').

File

./filefield_field.inc, line 11
FileField CCK field hooks and callbacks.

Code

function filefield_field_settings_form($field) {
  drupal_add_js(drupal_get_path('module', 'filefield') . '/filefield.js');
  $form = array();
  $form['list_field'] = array(
    '#type' => 'radios',
    '#title' => t('List field'),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#default_value' => $field['list_field'] === '' ? 0 : (int) $field['list_field'],
    '#description' => t('Display a checkbox where users may choose if a file should be shown when viewing the content. Most formatters other than <em>Generic file</em> do not support this option.'),
    '#attributes' => array(
      'class' => 'filefield-list-field',
    ),
  );
  $form['list_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Files listed by default'),
    '#default_value' => $field['list_default'] === '' ? 1 : (int) $field['list_default'],
  );
  $form['description_field'] = array(
    '#type' => 'radios',
    '#title' => t('Description field'),
    '#default_value' => $field['description_field'] === '' ? 0 : (int) $field['description_field'],
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#description' => t('Display a text field where users may enter a description about the uploaded file. The description text is used when using the <em>Generic file</em> formatter to link to the file, the file name will be used otherwise. Most other formatters do not use the description field on output.'),
  );
  return $form;
}