You are here

public function UcAddressesTextFieldHandler::getFormField in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 handlers/uc_addresses.handlers.inc \UcAddressesTextFieldHandler::getFormField()

Implements UcAddressesFieldHandler::getFormField().

Overrides UcAddressesFieldHandler::getFormField

File

handlers/uc_addresses.handlers.inc, line 22
Field handlers for Ubercart Addresses address fields:

Class

UcAddressesTextFieldHandler
Handler for a simple text field.

Code

public function getFormField($form, $form_values) {
  $fieldName = $this
    ->getFieldName();
  $fieldValue = $this
    ->getAddress()
    ->getField($fieldName);
  $default = isset($form_values[$fieldName]) ? $form_values[$fieldName] : $fieldValue;
  return array(
    $fieldName => array(
      '#type' => 'textfield',
      '#title' => $this
        ->getFieldTitle(),
      '#default_value' => $default,
      '#required' => $this
        ->isFieldRequired(),
      '#maxlength' => 20,
      '#size' => 32,
    ),
  );
}