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