public function UcAddressesAddressNameFieldHandler::getFormField in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 handlers/uc_addresses.handlers.inc \UcAddressesAddressNameFieldHandler::getFormField()
Implements UcAddressesFieldHandler::getFormField().
Overrides UcAddressesFieldHandler::getFormField
File
- handlers/
uc_addresses.handlers.inc, line 75 - Field handlers for Ubercart Addresses address fields:
Class
- UcAddressesAddressNameFieldHandler
- Class for the address name 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' => t('Save as'),
'#description' => t('Enter a name for this address (e.g. Home or Work)'),
'#default_value' => $default,
'#required' => $this
->isFieldRequired(),
'#maxlength' => 20,
'#size' => 32,
),
);
}