You are here

public function SearchApiFederatedSolrRemap::configurationFormSubmit in Search API Federated Solr 7.2

Same name and namespace in other branches
  1. 7.3 src/SearchApiFederatedSolrRemap.php \SearchApiFederatedSolrRemap::configurationFormSubmit()
  2. 7 src/SearchApiFederatedSolrRemap.php \SearchApiFederatedSolrRemap::configurationFormSubmit()

Not all of the source field information is available when the propertyInfo() method is called, so we set up the properties here and store them in the plugin options.

Overrides SearchApiAbstractAlterCallback::configurationFormSubmit

File

src/SearchApiFederatedSolrRemap.php, line 65

Class

SearchApiFederatedSolrRemap
Class SearchApiFederatedSolrRemap Provides a Search API index data alteration that remaps property names for indexed items.

Code

public function configurationFormSubmit(array $form, array &$values, array &$form_state) {
  $properties = [];
  $fields = $this->index
    ->getFields(FALSE);
  foreach (array_filter($values['remap']) as $destination => $source) {
    $properties[$destination] = [
      'label' => t('@field (remapped from @key)', [
        '@field' => $fields[$source]['name'],
        '@key' => $source,
      ]),
      'description' => $fields[$source]['description'],
      'type' => $fields[$source]['type'],
    ];
  }
  $values['properties'] = $properties;
  return parent::configurationFormSubmit($form, $values, $form_state);

  // TODO: Change the autogenerated stub
}