You are here

protected function WebformDisplayOnTrait::getDisplayOnOptions in Webform 6.x

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

Get display on options.

Parameters

bool $none: If TRUE none is include.

Return value

array An associative array of display on options.

5 calls to WebformDisplayOnTrait::getDisplayOnOptions()
WebformAttachmentBase::form in modules/webform_attachment/src/Plugin/WebformElement/WebformAttachmentBase.php
Gets the actual configuration webform array to be built.
WebformComputedBase::form in src/Plugin/WebformElement/WebformComputedBase.php
Gets the actual configuration webform array to be built.
WebformHorizontalRule::form in src/Plugin/WebformElement/WebformHorizontalRule.php
Gets the actual configuration webform array to be built.
WebformMarkupBase::form in src/Plugin/WebformElement/WebformMarkupBase.php
Gets the actual configuration webform array to be built.
WebformVariant::form in src/Plugin/WebformElement/WebformVariant.php
Gets the actual configuration webform array to be built.

File

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

Class

WebformDisplayOnTrait
Provides an 'display_on' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function getDisplayOnOptions($none = FALSE) {
  $options = [
    WebformElementDisplayOnInterface::DISPLAY_ON_FORM => $this
      ->t('form only'),
    WebformElementDisplayOnInterface::DISPLAY_ON_VIEW => $this
      ->t('viewed submission only'),
    WebformElementDisplayOnInterface::DISPLAY_ON_BOTH => $this
      ->t('both form and viewed submission'),
  ];
  if ($none) {
    $options[WebformElementDisplayOnInterface::DISPLAY_ON_NONE] = $this
      ->t('none');
  }
  return $options;
}