You are here

public function WebformDisplayOnTrait::buildText in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformDisplayOnTrait.php \Drupal\webform\Plugin\WebformElement\WebformDisplayOnTrait::buildText()
3 methods override WebformDisplayOnTrait::buildText()
WebformHorizontalRule::buildText in src/Plugin/WebformElement/WebformHorizontalRule.php
Build an element as text element.
WebformMarkupBase::buildText in src/Plugin/WebformElement/WebformMarkupBase.php
Build an element as text element.
WebformVariant::buildText in src/Plugin/WebformElement/WebformVariant.php
Build an element as text element.

File

src/Plugin/WebformElement/WebformDisplayOnTrait.php, line 40

Class

WebformDisplayOnTrait
Provides an 'display_on' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildText(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {

  // Hide element if it should not be displayed on 'view'.
  if (!$this
    ->isDisplayOn($element, WebformElementDisplayOnInterface::DISPLAY_ON_VIEW)) {
    return [];
  }
  return parent::buildText($element, $webform_submission, $options);
}