You are here

public static function WebformElementStates::getStateOptions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformElementStates.php \Drupal\webform\Element\WebformElementStates::getStateOptions()

Get an associative array of translated state options.

Return value

array An associative array of translated state options.

2 calls to WebformElementStates::getStateOptions()
WebformElementStates::processWebformStates in src/Element/WebformElementStates.php
Expand an email confirm field into two HTML5 email elements.
WebformUiEntityElementsForm::getElementRow in modules/webform_ui/src/WebformUiEntityElementsForm.php
Gets an row for a single element.

File

src/Element/WebformElementStates.php, line 1055

Class

WebformElementStates
Provides a webform element to edit an element's #states.

Namespace

Drupal\webform\Element

Code

public static function getStateOptions() {
  $visibility_optgroup = (string) t('Visibility');
  $state_optgroup = (string) t('State');
  $validation_optgroup = (string) t('Validation');
  $value_optgroup = (string) t('Value');
  return [
    $visibility_optgroup => [
      'visible' => t('Visible'),
      'invisible' => t('Hidden'),
      'visible-slide' => t('Visible (Slide)'),
      'invisible-slide' => t('Hidden (Slide)'),
    ],
    $state_optgroup => [
      'enabled' => t('Enabled'),
      'disabled' => t('Disabled'),
      'readwrite' => t('Read/write'),
      'readonly' => t('Read-only'),
      'expanded' => t('Expanded'),
      'collapsed' => t('Collapsed'),
    ],
    $validation_optgroup => [
      'required' => t('Required'),
      'optional' => t('Optional'),
    ],
    $value_optgroup => [
      'checked' => t('Checked'),
      'unchecked' => t('Unchecked'),
    ],
  ];
}