public function UcAddressesUcZoneFieldHandler::outputValue in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 handlers/ubercart.handlers.inc \UcAddressesUcZoneFieldHandler::outputValue()
Overrides UcAddressesFieldHandler::outputValue().
The zone field can be outputted in different formats.
Overrides UcAddressesFieldHandler::outputValue
File
- handlers/
ubercart.handlers.inc, line 154 - Field handlers for Ubercart core address fields: first_name, last_name, company, etc.
Class
- UcAddressesUcZoneFieldHandler
- Class for the Ubercart zone field.
Code
public function outputValue($value = '', $format = '') {
if ($value === '') {
$value = $this
->getAddress()
->getField($this
->getFieldName());
}
// Get zone data.
$result = db_query("SELECT * FROM {uc_zones} WHERE zone_id = %d", $value);
if (!($zone_data = db_fetch_array($result))) {
$zone_data = array(
'zone_code' => t('N/A'),
'zone_name' => t('Unknown'),
);
}
if (isset($zone_data[$format])) {
return $zone_data[$format];
}
// If no format is specified, return zone name.
return $zone_data['zone_name'];
}