You are here

protected function WebformUiEntityElementsForm::getParentOptions in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_ui/src/WebformUiEntityElementsForm.php \Drupal\webform_ui\WebformUiEntityElementsForm::getParentOptions()

Get parent (container) elements as options.

Parameters

array $elements: A flattened array of elements.

Return value

array Parent (container) elements as options.

1 call to WebformUiEntityElementsForm::getParentOptions()
WebformUiEntityElementsForm::buildForm in modules/webform_ui/src/WebformUiEntityElementsForm.php
Form constructor.

File

modules/webform_ui/src/WebformUiEntityElementsForm.php, line 433

Class

WebformUiEntityElementsForm
Webform manage elements UI form.

Namespace

Drupal\webform_ui

Code

protected function getParentOptions(array $elements) {
  $options = [];
  foreach ($elements as $key => $element) {
    $plugin_id = $this->elementManager
      ->getElementPluginId($element);
    $webform_element = $this->elementManager
      ->createInstance($plugin_id);
    if ($webform_element
      ->isContainer($element)) {
      $options[$key] = $element['#admin_title'] ?: $element['#title'];
    }
  }
  return $options;
}