You are here

protected static function CpfElement::validateValue in Brazilian IDs 8

Validates the submitted value.

Parameters

string $value: The value of the CPF or CNPJ number to be validated.

array $error: If provided, it is filled with the error message at $error['message'] if any.

Overrides CpfCnpjBase::validateValue

See also

\Drupal\brazilian_ids\BrazilianIdsService::validateCpfCnpj()

File

src/Element/CpfElement.php, line 31

Class

CpfElement
Plugin annotation @FormElement("brazilian_ids_cpf");

Namespace

Drupal\brazilian_ids\Element

Code

protected static function validateValue($value, array &$error = []) {
  return \Drupal::service('brazilian_ids')
    ->validateCpf($value, $error);
}