You are here

public function TextFormat::prepare in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/TextFormat.php \Drupal\webform\Plugin\WebformElement\TextFormat::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

src/Plugin/WebformElement/TextFormat.php, line 67

Class

TextFormat
Provides a 'text_format' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
  parent::prepare($element, $webform_submission);
  $this
    ->setElementDefaultCallback($element, 'process');
  $element['#process'][] = [
    get_class($this),
    'process',
  ];
  $element['#after_build'] = [
    [
      get_class($this),
      'afterBuild',
    ],
  ];
  $element['#attached']['library'][] = 'webform/webform.element.text_format';
}