You are here

function barcode_process in Barcode 6

Same name and namespace in other branches
  1. 6.2 barcode.module \barcode_process()

Process an individual element.

1 string reference to 'barcode_process'
barcode_elements in ./barcode.module
Implementation of FAPI hook_elements().

File

./barcode.module, line 214

Code

function barcode_process($element, $edit, $form_state, $form) {
  $field = $form['#field_info'][$element['#field_name']];
  $field_key = $element['#columns'][0];

  //here $field_key is barcode
  $delta = $element['#delta'];
  $element[$field_key] = array(
    '#type' => 'textfield',
    '#maxlength' => '20',
    '#size' => '20',
    '#title' => t($field['widget']['label']),
    '#description' => t($field['widget']['description']),
    '#required' => $element['#required'],
    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
  );
  if ($field['title'] != 'none' && $field['title'] != 'value') {
    $element['title'] = array(
      '#type' => 'textfield',
      '#maxlength' => '20',
      '#size' => '20',
      '#title' => t('Title'),
      '#required' => $field['title'] == 'required' && !empty($element['#value'][$field_key]) ? TRUE : FALSE,
      '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL,
    );
  }
  return $element;
}