You are here

function filefield_field_settings in FileField 5.2

Same name and namespace in other branches
  1. 5 filefield.module \filefield_field_settings()
  2. 6.3 filefield.module \filefield_field_settings()
  3. 6.2 filefield.module \filefield_field_settings()

Implementation of hook_field_settings().

File

./filefield.module, line 96
Defines a file field type.

Code

function filefield_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['force_list'] = array(
        '#type' => 'checkbox',
        '#title' => t('Always list files'),
        '#default_value' => isset($field['force_list']) ? $field['force_list'] : 0,
        '#description' => t('If enabled, the "List" checkbox will be hidden and files are always shown. Otherwise, the user can choose for each file whether it should be listed or not.'),
      );
      return $form;
    case 'validate':
      break;
    case 'save':
      return array(
        'force_list',
      );
    case 'database columns':
      $columns = array(
        'fid' => array(
          'type' => 'int',
          'not null' => TRUE,
          'default' => '0',
        ),
        'description' => array(
          'type' => 'varchar',
          length => 255,
          'not null' => TRUE,
          'default' => "''",
          'sortable' => TRUE,
        ),
        'list' => array(
          'type' => 'int',
          'not null' => TRUE,
          'default' => '0',
        ),
      );
      return $columns;
    case 'filters':
      return array(
        'not null' => array(
          'operator' => array(
            '=' => t('Has file'),
          ),
          'list' => 'views_handler_operator_yesno',
          'list-type' => 'select',
          'handler' => 'filefield_views_handler_filter_is_not_null',
        ),
      );
  }
}