You are here

function barcode_field_settings_form in Barcode 7.2

Implements hook_field_settings_form().

File

./barcode.module, line 173

Code

function barcode_field_settings_form($field, $instance, $has_data) {
  $form = array();
  $option = array(
    'UPC-A' => t('UPC-A'),
    'EAN-13' => t('EAN-13'),
    'ISBN' => t('ISBN'),
    'UPC-E' => t('UPC-E'),
    'EAN-8' => t('EAN-8'),
    'S2O5' => t('Standard 2 of 5'),
    'I2O5' => t('Industrial 2 of 5'),
    'I25' => t('Interleaved 2 of 5'),
    'POSTNET' => t('Postnet'),
    'CODABAR' => t('Codabar'),
    'CODE128' => t('Code 128'),
    'CODE39' => t('Code 39'),
    'CODE93' => t('Code 93'),
    'QRCODE' => t('QR Code'),
  );
  $form['encoding'] = array(
    '#type' => 'select',
    '#title' => t('Code Type'),
    '#options' => $option,
    '#default_value' => isset($field['settings']['encoding']) ? $field['settings']['encoding'] : $option['EAN-13'],
    '#description' => t('choose the coding method.'),
    '#disabled' => $has_data,
  );
  $form['dbsize'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length'),
    '#description' => t('The maximum length of the field in characters. Please change it according to the coding standard you have chosen to optimize your database space'),
    '#default_value' => isset($field['settings']['dbsize']) ? $field['settings']['dbsize'] : 255,
    '#size' => 4,
    '#required' => TRUE,
    '#disabled' => $has_data,
  );
  return $form;
}