You are here

public function TextField::prepare in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/TextField.php \Drupal\webform\Plugin\WebformElement\TextField::prepare()

Prepare an element to be rendered within a webform.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission. Webform submission is optional since it is not used by composite sub elements.

Overrides TextBase::prepare

See also

\Drupal\webform\Element\WebformCompositeBase::processWebformComposite

1 call to TextField::prepare()
WebformAutocomplete::prepare in src/Plugin/WebformElement/WebformAutocomplete.php
Prepare an element to be rendered within a webform.
1 method overrides TextField::prepare()
WebformAutocomplete::prepare in src/Plugin/WebformElement/WebformAutocomplete.php
Prepare an element to be rendered within a webform.

File

src/Plugin/WebformElement/TextField.php, line 42

Class

TextField
Provides a 'textfield' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
  if (!array_key_exists('#maxlength', $element)) {
    $element['#maxlength'] = 255;
  }
  parent::prepare($element, $webform_submission);
}