You are here

public function UcAddressesAddressNameFieldHandler::validateValue in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 handlers/uc_addresses.handlers.inc \UcAddressesAddressNameFieldHandler::validateValue()

Implements UcAddressesFieldHandler::validateValue().

Checks if the given name is unique.

Overrides UcAddressesFieldHandler::validateValue

File

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

Class

UcAddressesAddressNameFieldHandler
Class for the address name field.

Code

public function validateValue(&$value) {
  $fieldName = $this
    ->getFieldName();
  if ($value) {
    if (!$this
      ->getAddress()
      ->setName($value)) {
      form_set_error($fieldName, t('You already have an address named %name in your address book.', array(
        '%name' => $value,
      )));
    }
  }
}