You are here

protected function WebformDisplayOnTrait::isDisplayOn in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformDisplayOnTrait.php \Drupal\webform\Plugin\WebformElement\WebformDisplayOnTrait::isDisplayOn()

Check is the element is display on form, view, or both.

Parameters

array $element: An element.

string $display_on: Display on form or view.

Return value

bool TRUE if the element should be displayed on the form or view.

13 calls to WebformDisplayOnTrait::isDisplayOn()
WebformComputedBase::prepare in src/Plugin/WebformElement/WebformComputedBase.php
Prepare an element to be rendered within a webform.
WebformDisplayOnTrait::buildHtml in src/Plugin/WebformElement/WebformDisplayOnTrait.php
WebformDisplayOnTrait::buildText in src/Plugin/WebformElement/WebformDisplayOnTrait.php
WebformDisplayOnTrait::prepare in src/Plugin/WebformElement/WebformDisplayOnTrait.php
WebformHorizontalRule::buildHtml in src/Plugin/WebformElement/WebformHorizontalRule.php
Build an element as HTML element.

... See full list

File

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

Class

WebformDisplayOnTrait
Provides an 'display_on' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function isDisplayOn(array $element, $display_on) {
  $element_display_on = isset($element['#display_on']) ? $element['#display_on'] : $this
    ->getDefaultProperty('display_on');
  return $element_display_on === WebformElementDisplayOnInterface::DISPLAY_ON_BOTH || $element_display_on === $display_on ? TRUE : FALSE;
}