summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoris Vercammen2015-11-19 11:15:36 (GMT)
committerJoris Vercammen2015-11-19 11:15:36 (GMT)
commit1dc990c7df3fef79eaf958b4e0c931535d4e1d07 (patch)
tree564730bbdf9d2c6bdecaa1ee38f76c68888f06ba
parenta66b17d0d93e15f6adbe6f83412bb23a9cd67fc0 (diff)
-rw-r--r--src/Form/FacetSourceConfigForm.php8
-rw-r--r--src/Processor/UrlProcessorPluginBase.php1
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Form/FacetSourceConfigForm.php b/src/Form/FacetSourceConfigForm.php
index 01bee8d..198af19 100644
--- a/src/Form/FacetSourceConfigForm.php
+++ b/src/Form/FacetSourceConfigForm.php
@@ -34,12 +34,13 @@ class FacetSourceConfigForm extends ConfigFormBase {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('facetapi.facet_source');
+ $facet_source_id = $this->getRequest()->get('source_id');
+ $overridden_filter_key_config = $config->get('overrides.' . $facet_source_id . '.filter_key');
$form['description'] = [
'#markup' => $this->t('Saving this form will create a configuration override for this specific facet source. Not doing so will make sure that Facet API uses the default settings. This is an advanced feature and unless you are fully aware of why you\'re creating this configuration. With a default configuration of Facet API you can leave the default configuration.')
];
- $facet_source_id = $this->getRequest()->get('source_id');
$form['facet_source_id'] = [
'#type' => 'hidden',
'#value' => $facet_source_id,
@@ -51,7 +52,7 @@ class FacetSourceConfigForm extends ConfigFormBase {
'#title' => $this->t('Filter key'),
'#size' => 20,
'#maxlength' => 255,
- '#default_value' => (!is_null($config->get('overrides.' . $facet_source_id . '.filter_key')) ? $config->get('overrides.' . $facet_source_id . '.filter_key') : $config->get('filter_key')),
+ '#default_value' => (!is_null($overridden_filter_key_config) ? $overridden_filter_key_config : $config->get('filter_key')),
'#description' => $this->t('They key used for filtering in the URL, defaults to f. You should change this to something else if you expect to have multiple facet sources on one page.'),
];
@@ -68,6 +69,9 @@ class FacetSourceConfigForm extends ConfigFormBase {
$configKey = 'overrides.' . $form_state->getValue('facet_source_id') . '.';
+ // When saving the config, make sure it's saved in the
+ // 'overrides.facetsourceid.*' config name, so we can make sure that config
+ // is possible to be overridden per facet source.
$config = $this->config('facetapi.facet_source');
$config->set($configKey. 'filter_key', $form_state->getValue('filter_key'));
$config->save();
diff --git a/src/Processor/UrlProcessorPluginBase.php b/src/Processor/UrlProcessorPluginBase.php
index 1589216..c9fd324 100644
--- a/src/Processor/UrlProcessorPluginBase.php
+++ b/src/Processor/UrlProcessorPluginBase.php
@@ -49,7 +49,6 @@ abstract class UrlProcessorPluginBase extends ProcessorPluginBase implements Url
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->request = $request;
- /** @var \Drupal\facetapi\FacetInterface[] $configuration */
$facetSourceId = $configuration['facet']->getFacetSourceId();
$facetSourceConfig = $config_factory->get('facetapi.facet_source');