You are here

public function WebformVariant::buildHtml in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformVariant.php \Drupal\webform\Plugin\WebformElement\WebformVariant::buildHtml()

Build an element as HTML element.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

array $options: An array of options.

Return value

array A render array representing an element as HTML.

Overrides WebformDisplayOnTrait::buildHtml

File

src/Plugin/WebformElement/WebformVariant.php, line 105

Class

WebformVariant
Provides a 'webform_variant' element.

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);
}