|
|
|
|
@ -33,7 +33,7 @@ final class RoblibAlterSolrSettingsForm extends ConfigFormBase {
|
|
|
|
|
$config = $this->config('roblib_alter_solr.settings'); |
|
|
|
|
$solr_config = $this->config('search_api.index.default_solr_index'); |
|
|
|
|
$solr_fields = $solr_config->get('field_settings'); |
|
|
|
|
$fields_options = []; |
|
|
|
|
$fields_options = [' - ' => ' - ']; |
|
|
|
|
foreach ($solr_fields as $name => $field) { |
|
|
|
|
$fields_options[$name] = $field['label'] . ' - ' . $name; |
|
|
|
|
} |
|
|
|
|
@ -183,6 +183,9 @@ final class RoblibAlterSolrSettingsForm extends ConfigFormBase {
|
|
|
|
|
$user_input = $form_state->getUserInput(); |
|
|
|
|
$unique_id = uniqid(); |
|
|
|
|
$pairs = $user_input['pairs'] ?? []; |
|
|
|
|
$pairs= array_filter($pairs, function ($item) { |
|
|
|
|
return !empty($item['destination']); |
|
|
|
|
}); |
|
|
|
|
$pairs[$unique_id] = ['source' => '', 'destination' => '']; |
|
|
|
|
$form_state->set('pairs', $pairs); |
|
|
|
|
$form_state->setRebuild(); |
|
|
|
|
@ -217,7 +220,7 @@ final class RoblibAlterSolrSettingsForm extends ConfigFormBase {
|
|
|
|
|
public function submitForm(array &$form, FormStateInterface $form_state) { |
|
|
|
|
$pairs = $form_state->getValue('pairs'); |
|
|
|
|
$filtered_pairs= array_filter($pairs, function ($item) { |
|
|
|
|
return !empty($item['destination']); |
|
|
|
|
return !empty($item['destination']) && !isset($item['add']); |
|
|
|
|
}); |
|
|
|
|
$normalize = $form_state->getValue('normalize'); |
|
|
|
|
$this->config('roblib_alter_solr.settings') |
|
|
|
|
|