You are here

public function MappingEditForm::prepareOptions in GatherContent 8.3

Prepare options for every language for every field.

Return value

array Array with options.

1 call to MappingEditForm::prepareOptions()
MappingEditForm::submitForm in src/Form/MappingEditForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/MappingEditForm.php, line 1075

Class

MappingEditForm
Class MappingEditForm.

Namespace

Drupal\gathercontent\Form

Code

public function prepareOptions() {
  $options = [];
  foreach ($this->entityReferenceFields as $field => $gcMapping) {
    foreach ($gcMapping as $lang => $fieldSettings) {
      foreach ($this->template->config as $tab) {
        if ($tab->name === $fieldSettings['tab']) {
          foreach ($tab->elements as $element) {
            if ($element->name === $fieldSettings['name']) {
              foreach ($element->options as $option) {
                if (!isset($option->value)) {
                  $options[$option->name] = $option->label;
                }
              }
            }
          }
        }
      }
    }
  }
  return $options;
}