CnpjElement.php in Brazilian IDs 8
File
src/Element/CnpjElement.php
View source
<?php
namespace Drupal\brazilian_ids\Element;
class CnpjElement extends CpfCnpjBase {
public function getInfo() {
$info = parent::getInfo();
$info['#maxlength'] = 18;
return $info;
}
protected function getMaskDefaults() {
return [
'value' => '00.000.000/0000-00',
];
}
protected static function validateValue($value, array &$error = []) {
return \Drupal::service('brazilian_ids')
->validateCnpj($value, $error);
}
}
Classes
Name |
Description |
CnpjElement |
Plugin annotation
@FormElement("brazilian_ids_cnpj"); |