You are here

function barcode_field_settings in Barcode 6

Same name and namespace in other branches
  1. 6.2 barcodefield.module \barcode_field_settings()

Implementation of hook_field_settings().

File

./barcode.module, line 41

Code

function barcode_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array(
        '#theme' => 'barcode_field_settings',
      );
      $title_options = array(
        'optional' => t('Optional Title'),
        'required' => t('Required Title'),
        'none' => t('No Title'),
      );
      $form['title'] = array(
        '#type' => 'radios',
        '#title' => t('Bar Code Title'),
        '#default_value' => isset($field['title']) ? $field['title'] : 'optional',
        '#options' => $title_options,
        '#description' => t('If the barcode title is optional or required, a field will be displayed to the end user.'),
      );
      return $form;
    case 'save':
      return array(
        'title',
        'title_value',
      );
    case 'database columns':
      return array(
        'barcode' => array(
          'type' => 'varchar',
          'length' => 20,
          'not null' => FALSE,
          'sortable' => TRUE,
        ),
        'title' => array(
          'type' => 'varchar',
          'length' => 20,
          'not null' => FALSE,
          'sortable' => TRUE,
        ),
      );
  }
}