diff --git a/tests/features/joinup_search/archive.feature b/tests/features/joinup_search/archive.feature index e590833c7943028fc1c7f6843555d5f71e12dc5d..5c8f24e00cca42698b04ac2646dcf13677d5ce2a 100644 --- a/tests/features/joinup_search/archive.feature +++ b/tests/features/joinup_search/archive.feature @@ -11,21 +11,30 @@ Feature: Global search with archive content And the following <group type>s: | title | description | state | | Some <group type> | Description | validated | + | Rare <group type> | Description | validated | And event content: | title | short title | body | spatial coverage | agenda | location | organisation | scope | <group type> | state | | Event 1 | Event 1 | Some body | Greece | Some agenta | Some place | European Commission | International | Some <group type> | validated | + | Event 2 | Event 2 | Some body | Greece | Some agenta | Some place | European Commission | International | Rare <group type> | validated | + | Event 3 | Event 3 | Some body | Greece | Some agenta | Some place | European Commission | International | Rare <group type> | validated | + | Event 4 | Event 4 | Some body | Greece | Some agenta | Some place | European Commission | International | Rare <group type> | validated | And document content: | title | document type | short title | body | spatial coverage | <group type> | state | | Some document 1 | Document | Some document 1 | Some body | Luxembourg | Some <group type> | validated | When the "Some <group type>" <group type> is configured to show "All" community content in the overview And the "Some <group type>" <group type> is configured to show the "<bundle label> content archived toggle" facet in the "Top" region + When the "Rare <group type>" <group type> is configured to show "All" community content in the overview + And the "Rare <group type>" <group type> is configured to show the "<bundle label> content archived toggle" facet in the "Top" region When I go to the homepage of the "Some <group type>" <group type> Then I should not see the "<group type> content archived toggle" facet And I should see the following tiles in the correct order: | Event 1 | | Some document 1 | + When I go to the homepage of the "Rare <group type>" <group type> + Then I should not see the "<group type> content archived toggle" facet + Given event content: | title | short title | body | spatial coverage | agenda | location | organisation | scope | <group type> | state | | Event 2 | Event 2 | Some body | Greece | Some agenta | Some place | European Commission | International | Some <group type> | archived | @@ -53,6 +62,9 @@ Feature: Global search with archive content And I should not see the "Event 1" tile And I should not see the "Some document 1" tile + When I go to the homepage of the "Rare <group type>" <group type> + Then I should not see the "<group type> content archived toggle" facet + Examples: | bundle label | group type | | Collection | collection | diff --git a/web/modules/custom/joinup_search/src/EventSubscriber/SearchApiStatusSubscriber.php b/web/modules/custom/joinup_search/src/EventSubscriber/SearchApiStatusSubscriber.php index 7030b3100ae688d546daeca83e9d9ebe13fa3b1c..b42d37fb61d9280d7c89194884faa857ded5f6dc 100644 --- a/web/modules/custom/joinup_search/src/EventSubscriber/SearchApiStatusSubscriber.php +++ b/web/modules/custom/joinup_search/src/EventSubscriber/SearchApiStatusSubscriber.php @@ -6,7 +6,6 @@ use Drupal\facets\FacetInterface; use Drupal\facets\FacetManager\DefaultFacetManager; -use Drupal\joinup_user\Entity\JoinupUserInterface; use Drupal\paragraphs\ParagraphInterface; use Drupal\search_api\Event\QueryPreExecuteEvent; use Drupal\search_api\Event\SearchApiEvents; @@ -107,22 +106,6 @@ public function paragraphContentListingQueryAlter(QueryPreExecuteEvent $event): $this->getConditionGroupInterfaces($query); } - /** - * Reacts to the query alter event for user content listings. - * - * @param \Drupal\search_api\Event\QueryPreExecuteEvent $event - * The query alter event. - */ - public function userContentListingQueryAlter(QueryPreExecuteEvent $event): void { - $query = $event->getQuery(); - $entity = $query->getOption('search_api_field entity'); - if (!($entity instanceof JoinupUserInterface)) { - return; - } - - $this->getConditionGroupInterfaces($query); - } - /** * Add archive condition in query. * diff --git a/web/modules/custom/search_api_field/src/Plugin/Field/FieldFormatter/SearchFormatter.php b/web/modules/custom/search_api_field/src/Plugin/Field/FieldFormatter/SearchFormatter.php index 59fa3135dd151afcca428754f9f9c98d0bd4e959..47700f4b6ab4454e0f41a3a9516566b57ba4886f 100644 --- a/web/modules/custom/search_api_field/src/Plugin/Field/FieldFormatter/SearchFormatter.php +++ b/web/modules/custom/search_api_field/src/Plugin/Field/FieldFormatter/SearchFormatter.php @@ -277,6 +277,7 @@ protected function getArchivedQuery(array $settings, SearchItemInterface $item): } $hooks = [ 'search_api_field', + 'search_api_field_' . $field_definition->getName(), 'search_api_field_' . $field_definition->getName() . '_archived', ]; foreach ($hooks as $hook) {