You are here

protected static function WebformElementStates::buildSourceHelp in Webform 6.x

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

Build edit source help.

Parameters

array $element: An element.

Return value

array A renderable array.

1 call to WebformElementStates::buildSourceHelp()
WebformElementStates::processWebformStates in src/Element/WebformElementStates.php
Expand an email confirm field into two HTML5 email elements.

File

src/Element/WebformElementStates.php, line 287

Class

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

Namespace

Drupal\webform\Element

Code

protected static function buildSourceHelp(array $element) {
  $build = [];
  $build['states'] = [
    'title' => [
      '#markup' => t('Available states'),
      '#prefix' => '<strong>',
      '#suffix' => '</strong>',
    ],
    'items' => static::convertOptionToItemList($element['#state_options']),
  ];
  if ($element['#selector_options']) {
    $build['selectors'] = [
      'title' => [
        '#markup' => t('Available selectors'),
        '#prefix' => '<strong>',
        '#suffix' => '</strong>',
      ],
      'items' => static::convertOptionToItemList($element['#selector_options']),
    ];
  }
  $build['triggers'] = [
    'title' => [
      '#markup' => t('Available triggers'),
      '#prefix' => '<strong>',
      '#suffix' => '</strong>',
    ],
    'items' => static::convertOptionToItemList($element['#trigger_options']),
  ];
  return $build;
}