You are here

public function WebformEmailConfirm::prepare in Webform 6.x

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

File

src/Plugin/WebformElement/WebformEmailConfirm.php, line 50

Class

WebformEmailConfirm
Provides a 'email_confirm' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

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

  // Set confirm description.
  if (isset($element['#confirm__description'])) {
    $element['#confirm__description'] = WebformHtmlEditor::checkMarkup($element['#confirm__description']);
  }

  // If #flexbox is not set or an empty string, determine if the
  // webform is using a flexbox layout.
  if ((!isset($element['#flexbox']) || $element['#flexbox'] === '') && $webform_submission) {
    $webform = $webform_submission
      ->getWebform();
    $element['#flexbox'] = $webform
      ->hasFlexboxLayout();
  }
}