You are here

public function WebformDisplayOnTrait::buildHtml in Webform 8.5

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

File

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

Class

WebformDisplayOnTrait
Provides an 'display_on' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildHtml(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::buildHtml($element, $webform_submission, $options);
}