TextField.php in Webform 6.x
File
src/Plugin/WebformElement/TextField.php
View source
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\webform\WebformSubmissionInterface;
class TextField extends TextBase {
protected function defineDefaultProperties() {
return [
'input_mask' => '',
'input_hide' => FALSE,
'counter_type' => '',
'counter_minimum' => NULL,
'counter_minimum_message' => '',
'counter_maximum' => NULL,
'counter_maximum_message' => '',
] + parent::defineDefaultProperties() + $this
->defineDefaultMultipleProperties();
}
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
if (!array_key_exists('#maxlength', $element)) {
$element['#maxlength'] = 255;
}
parent::prepare($element, $webform_submission);
}
}