You are here

public function WebformTestElement::prepare in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/modules/webform_test_element/src/Plugin/WebformElement/WebformTestElement.php \Drupal\webform_test_element\Plugin\WebformElement\WebformTestElement::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 WebformElementBase::prepare

See also

\Drupal\webform\Element\WebformCompositeBase::processWebformComposite

File

tests/modules/webform_test_element/src/Plugin/WebformElement/WebformTestElement.php, line 23

Class

WebformTestElement
Provides a 'webform_test_element' element.

Namespace

Drupal\webform_test_element\Plugin\WebformElement

Code

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
  $this
    ->displayMessage(__FUNCTION__);
  $element['#element_validate'][] = [
    get_class($this),
    'validate',
  ];
}