You are here

public function MappingEditForm::extractMappingData in GatherContent 8.3

Extract mapping data from submitted form values.

Parameters

array $formValues: Array with all submitted values.

Return value

array Mapping data.

1 call to MappingEditForm::extractMappingData()
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 1346

Class

MappingEditForm
Class MappingEditForm.

Namespace

Drupal\gathercontent\Form

Code

public function extractMappingData(array $formValues) {
  $form_definition_elements = [
    'return',
    'form_build_id',
    'form_token',
    'form_id',
    'op',
  ];
  $non_data_elements = array_merge($form_definition_elements, [
    'gc_template',
    'content_type',
    'id',
    'updated',
    'gathercontent_project',
    'gathercontent_template',
  ]);
  $mapping_data = [];
  foreach ($formValues as $key => $value) {
    if (!in_array($key, $non_data_elements) && substr_compare($key, 'tab', 0, 3) === 0) {
      $mapping_data[$key] = $value;
    }
  }
  $this->mappingData = $mapping_data;
  return $mapping_data;
}