Skip to content

Commit

Permalink
EWPP-2570: Rename event related to facet update.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergepavle authored and upchuk committed Jun 21, 2023
1 parent aff06d5 commit 1cbef6b
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 24 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"drupal/facets": "^2.0",
"drupal/multivalue_form_element": "^1.0@beta",
"drupal/search_api": "^1.27",
"symfony/options-resolver": "^4.4.30 || ^5 || ^6"
"symfony/options-resolver": "^4.4.30 || ^5 || ^6",
"symfony/validator": "~v4.4.48 || ~v6.2.5"
},
"require-dev": {
"composer/installers": "^1.11",
Expand All @@ -29,6 +30,9 @@
"openeuropa/task-runner-drupal-project-symlink": "^1.0.0-beta5",
"phpspec/prophecy-phpunit": "^2"
},
"_readme": [
"Using symfony/validator v6.2.5 for D10 like core-recommended does because 6.3 breaks BC with the signature changes to the ExecutionContextInterface. Can be removed when 6.3.1 comes out."
],
"scripts": {
"post-install-cmd": "./vendor/bin/run drupal:site-setup",
"post-update-cmd": "./vendor/bin/run drupal:site-setup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
use Symfony\Component\EventDispatcher\Event;

/**
* Event fired when a facet is created from an open vocabularies association.
* Event fired when a facet is updated from an open vocabularies association.
*/
class AssociationFacetCreationEvent extends Event {
class AssociationFacetUpdateEvent extends Event {

/**
* The name of the event.
*/
const NAME = 'oe_list_pages_open_vocabularies.associated_facet_creation_event';
const NAME = 'oe_list_pages_open_vocabularies.associated_facet_update_event';

/**
* The created but not yet saved facet.
Expand All @@ -25,7 +25,7 @@ class AssociationFacetCreationEvent extends Event {
protected $facet;

/**
* AssociationFacetCreationEvent constructor.
* AssociationFacetUpdateEvent constructor.
*
* @param \Drupal\facets\FacetInterface $facet
* The created but not yet saved facet.
Expand All @@ -52,7 +52,7 @@ public function getFacet(): FacetInterface {
*
* @return $this
*/
public function setFacet(FacetInterface $facet): AssociationFacetCreationEvent {
public function setFacet(FacetInterface $facet): AssociationFacetUpdateEvent {
$this->facet = $facet;
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Drupal\facets\FacetInterface;
use Drupal\language\Config\LanguageConfigOverride;
use Drupal\oe_list_pages\ListSourceFactoryInterface;
use Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetCreationEvent;
use Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetUpdateEvent;
use Drupal\open_vocabularies\OpenVocabularyAssociationInterface;
use Drupal\search_api\IndexInterface;
use Drupal\search_api\Item\Field;
Expand Down Expand Up @@ -145,8 +145,8 @@ public function updateConfig(OpenVocabularyAssociationInterface $association, st
$facet->setFieldIdentifier($property_path);

// Use event dispatching to allow alter facet config before saving.
$event = new AssociationFacetCreationEvent($facet);
$this->eventDispatcher->dispatch($event, AssociationFacetCreationEvent::NAME);
$event = new AssociationFacetUpdateEvent($facet);
$this->eventDispatcher->dispatch($event, AssociationFacetUpdateEvent::NAME);
$event->getFacet()->save();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Drupal\oe_list_pages_open_vocabularies_test\EventSubscriber;

use Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetCreationEvent;
use Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetUpdateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
Expand All @@ -16,17 +16,17 @@ class SearchApiFacetTestSubscriber implements EventSubscriberInterface {
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[AssociationFacetCreationEvent::NAME] = 'onFacetUpdate';
$events[AssociationFacetUpdateEvent::NAME] = 'onFacetUpdate';
return $events;
}

/**
* Updates the open vocabulary facets before saving.
*
* @param \Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetCreationEvent $event
* @param \Drupal\oe_list_pages_open_vocabularies\Event\AssociationFacetUpdateEvent $event
* The Search API Facet update event.
*/
public function onFacetUpdate(AssociationFacetCreationEvent $event) {
public function onFacetUpdate(AssociationFacetUpdateEvent $event) {
$facet = $event->getFacet();
$settings = [
'behavior' => 'text',
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ListPageRssController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
use Drupal\oe_list_pages\FacetManipulationTrait;
use Drupal\oe_list_pages\ListExecutionManagerInterface;
use Drupal\oe_list_pages\ListPageConfiguration;
use Drupal\oe_list_pages\ListPageRssAlterEvent;
use Drupal\oe_list_pages\ListPageEvents;
use Drupal\oe_list_pages\ListPageRssAlterEvent;
use Drupal\oe_list_pages\ListPageRssItemAlterEvent;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactoryInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/QuerySubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use Drupal\facets\FacetInterface;
use Drupal\facets\FacetSource\FacetSourcePluginManager;
use Drupal\facets\QueryType\QueryTypePluginManager;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListFacetManagerWrapper;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\search_api\Event\QueryPreExecuteEvent;
use Drupal\search_api\Event\SearchApiEvents;
use Drupal\search_api\Query\ConditionGroupInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ListPageConfigurationSubForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use Drupal\Core\Form\SubformState;
use Drupal\Core\Render\Element\Select;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPageConfiguration;
use Drupal\oe_list_pages\ListPageConfigurationSubformInterface;
use Drupal\oe_list_pages\ListPageEvents;
use Drupal\oe_list_pages\ListPageSortOptionsResolver;
use Drupal\oe_list_pages\ListPageSourceAlterEvent;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListSourceFactoryInterface;
use Drupal\oe_list_pages\ListSourceInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ListPageConfigurationSubformFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPageConfiguration;
use Drupal\oe_list_pages\ListPageConfigurationFactoryInterface;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPageSortOptionsResolver;
use Drupal\oe_list_pages\ListSourceFactoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Drupal\Core\State\StateInterface;
use Drupal\oe_list_pages\ListPageDisallowSortEvent;
use Drupal\oe_list_pages\ListPageRssAlterEvent;
use Drupal\oe_list_pages\ListPageEvents;
use Drupal\oe_list_pages\ListPageRssAlterEvent;
use Drupal\oe_list_pages\ListPageRssItemAlterEvent;
use Drupal\oe_list_pages\ListPageSortAlterEvent;
use Drupal\oe_list_pages\ListPageSortOptionsResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Drupal\facets\Entity\Facet;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\oe_list_pages\Plugin\facets\query_type\DateStatus;
use Drupal\search_api\Entity\Index;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/DateStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Drupal\Tests\oe_list_pages\Kernel;

use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\oe_list_pages\Plugin\facets\query_type\DateStatus;

Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/DateWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Drupal\Tests\oe_list_pages\Kernel;

use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\oe_list_pages\Plugin\facets\query_type\Date;
use Drupal\oe_list_pages\Plugin\facets\widget\DateWidget;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/FulltextWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Drupal\Tests\oe_list_pages\Kernel;

use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\oe_list_pages\Plugin\facets\widget\FulltextWidget;

Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/ListsQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Drupal\facets\Entity\Facet;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\search_api\Item\Field;
use Drupal\search_api\Query\ConditionGroup;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/MultiSelectWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Drupal\Tests\oe_list_pages\Kernel;

use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\DefaultFilterConfigurationBuilder;
use Drupal\oe_list_pages\ListPresetFilter;
use Drupal\oe_list_pages\ListSourceFactory;
use Drupal\oe_list_pages\Plugin\facets\widget\MultiselectWidget;

Expand Down

0 comments on commit 1cbef6b

Please sign in to comment.