You are here

public static function YamlFormExcludedColumns::getYamlFormExcludedOptions in YAML Form 8

Get options for excluded tableselect element.

Parameters

array $element: An associative array containing the properties and children of the generic element element.

Return value

array An array of options containing title, name, and type of items for a tableselect element.

Overrides YamlFormExcludedBase::getYamlFormExcludedOptions

File

src/Element/YamlFormExcludedColumns.php, line 22

Class

YamlFormExcludedColumns
Provides a form element for form excluded columns (submission field and elements).

Namespace

Drupal\yamlform\Element

Code

public static function getYamlFormExcludedOptions(array $element) {
  $options = [];

  /** @var \Drupal\yamlform\YamlFormSubmissionStorageInterface $submission_storage */
  $submission_storage = \Drupal::entityTypeManager()
    ->getStorage('yamlform_submission');
  $field_definitions = $submission_storage
    ->getFieldDefinitions();
  foreach ($field_definitions as $key => $field_definition) {
    $options[$key] = [
      [
        'title' => $field_definition['title'],
      ],
      [
        'name' => $key,
      ],
      [
        'type' => $field_definition['type'],
      ],
    ];
  }
  $options += parent::getYamlFormExcludedOptions($element);
  return $options;
}