You are here

public function WebformTermsOfService::prepare in Webform 8.5

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

Class

WebformTermsOfService
Provides a 'terms_of_service' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

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

  // Restore #title with curly brackets.
  if (isset($element['#_webform_terms_of_service_title'])) {
    $element['#title'] = $element['#_webform_terms_of_service_title'];
    unset($element['#_webform_terms_of_service_title']);
  }
  parent::prepare($element, $webform_submission);
  if (isset($element['#terms_content'])) {
    $element['#terms_content'] = WebformHtmlEditor::checkMarkup($element['#terms_content']);
  }
}