From fca365ee657a465f9c5255c46389083c33820437 Mon Sep 17 00:00:00 2001 From: Andrii Podanenko Date: Fri, 30 Apr 2021 15:45:27 +0300 Subject: [PATCH 1/2] Fix for Locations Filter --- .../src/Form/LocationFilterSettingsForm.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php b/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php index be76c8018e..3e767bbcd4 100644 --- a/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php +++ b/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php @@ -126,11 +126,17 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /** @var \Drupal\Core\Config\Config $config */ $config = $this->config(self::CONFIG_NAME); $locations = $form_state->getValue('locations'); - if (isset($locations['All'])) { - $branches_list = $this->getBranchesList(); - $locations = $branches_list['branch'] + $branches_list['camp']; + + $branches_list = $this->getBranchesList(); + + foreach ($locations as $id => $status) { + if ($id != 'All' && $status == $id) { + $new_locations[$id] = $status; + } } - $config->set('locations', $locations)->save(); + + $config->set('locations', $new_locations)->save(); + Cache::invalidateTags(['rendered']); parent::submitForm($form, $form_state); From a1b8c665422b9a790fc6484108c3a7c883e6fcc2 Mon Sep 17 00:00:00 2001 From: Andrii Podanenko Date: Fri, 30 Apr 2021 18:12:23 +0300 Subject: [PATCH 2/2] removed unused code --- .../openy_loc_filter/src/Form/LocationFilterSettingsForm.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php b/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php index 3e767bbcd4..11f26d402a 100644 --- a/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php +++ b/modules/openy_features/openy_location/modules/openy_loc_filter/src/Form/LocationFilterSettingsForm.php @@ -127,8 +127,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->config(self::CONFIG_NAME); $locations = $form_state->getValue('locations'); - $branches_list = $this->getBranchesList(); - foreach ($locations as $id => $status) { if ($id != 'All' && $status == $id) { $new_locations[$id] = $status;