You are here

public function UcAddressesDateFieldHandler::outputValue in Ubercart Addresses 7

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

Overrides UcAddressesFieldHandler::outputValue().

If a format is specified, the value will be formatted using that (date) format. If no format is specified, the value will be formatted using the site default date format.

Overrides UcAddressesFieldHandler::outputValue

File

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

Class

UcAddressesDateFieldHandler
Class for the created/modified field.

Code

public function outputValue($value = '', $format = '') {
  $values =& drupal_static('UcAddressesDateFieldHandler::outputValue', array());
  if ($value === '') {
    $value = $this
      ->getAddress()
      ->getField($this
      ->getFieldName());
  }
  if (isset($values[$value][$format])) {
    return $values[$value][$format];
  }
  if ($format) {
    $token = token_generate('date', array(
      $format => $format,
    ), array(
      'date' => $value,
    ));
    if (isset($token[$format])) {
      $values[$value][$format] = $token[$format];
    }
  }
  else {
    $values[$value][$format] = format_date($value);
  }
  if (isset($values[$value][$format])) {
    return $values[$value][$format];
  }
}