You are here

public function UcAddressesUcTextFieldHandler::getFormField in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 handlers/ubercart.handlers.inc \UcAddressesUcTextFieldHandler::getFormField()

Implements UcAddressesFieldHandler::getFormField().

Overrides UcAddressesFieldHandler::getFormField

File

handlers/ubercart.handlers.inc, line 47
Field handlers for Ubercart core address fields: first_name, last_name, company, etc.

Class

UcAddressesUcTextFieldHandler
Class for an Ubercart core address 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(),
      '#required' => $this
        ->isFieldRequired(),
      '#default_value' => $default,
      '#size' => 32,
    ),
  );
}