You are here

function barcode_example_form in Barcode 6.2

1 string reference to 'barcode_example_form'
barcode_example_menu in modules/barcode_example/barcode_example.module

File

modules/barcode_example/barcode_example.module, line 13

Code

function barcode_example_form(&$form_state) {
  $encoding = variable_get('barcode_encoding', 'EAN-13');
  if (isset($form_state['barcode'])) {
    $form['barcode_image'] = array(
      '#value' => theme('barcode_image', $form_state['barcode'], $encoding),
    );
  }
  $settings = url('admin/settings/barcode', array(
    'query' => array(
      'destination' => 'barcode_example',
    ),
  ));
  $form['barcode'] = array(
    '#type' => 'barcode',
    '#title' => t('Barcode'),
    '#description' => t('Enter an EAN-13 barcode.'),
    '#encoding' => 'EAN-13',
    '#description' => t('Enter a number to generate a barcode image using the %encoding encoding. You can change which encoding is used in the <a href="@settings">Barcode settings page</a>.', array(
      '%encoding' => $encoding,
      '@settings' => $settings,
    )),
    '#encoding' => $encoding,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Show the barcode'),
  );
  return $form;
}