You are here

protected static function CnpjElement::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/CnpjElement.php, line 31

Class

CnpjElement
Plugin annotation @FormElement("brazilian_ids_cnpj");

Namespace

Drupal\brazilian_ids\Element

Code

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