You are here

public function WebformOptionsCustom::prepare in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_options_custom/src/Plugin/WebformElement/WebformOptionsCustom.php \Drupal\webform_options_custom\Plugin\WebformElement\WebformOptionsCustom::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 Select::prepare

See also

\Drupal\webform\Element\WebformCompositeBase::processWebformComposite

File

modules/webform_options_custom/src/Plugin/WebformElement/WebformOptionsCustom.php, line 73

Class

WebformOptionsCustom
Provides a custom options element.

Namespace

Drupal\webform_options_custom\Plugin\WebformElement

Code

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {

  // Remove the #template property to make sure people can't inject
  // custom markup.
  $this
    ->setOptions($element, [
    'webform_submission' => $webform_submission,
  ]);
  parent::prepare($element, $webform_submission);
}