diff --git a/core/core.services.yml b/core/core.services.yml index b6d742d..e1e59a2 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -308,7 +308,7 @@ services: class: Drupal\Core\Path\PathCRUDSubscriber tags: - { name: event_subscriber } - arguments: ['@path.alias_manager.cached', '@module_handler'] + arguments: ['@path.alias_manager.cached'] # The argument to the hashing service defined in services.yml, to the # constructor of PhpassHashedPassword is the log2 number of iterations for # password stretching. diff --git a/core/lib/Drupal/Core/Path/Path.php b/core/lib/Drupal/Core/Path/Path.php index 024b297..1b03239 100644 --- a/core/lib/Drupal/Core/Path/Path.php +++ b/core/lib/Drupal/Core/Path/Path.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Path; -use Drupal\Core\Database\Database; use Drupal\Core\Database\Connection; use Drupal\Core\Language\Language; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -18,27 +17,6 @@ class Path { /** - * The INSERT event occurs when a new path alias is inserted. - * - * @var string - */ - const INSERT = 'path.insert'; - - /** - * The UPDATE event occurs when an existing path alias is updated. - * - * @var string - */ - const UPDATE = 'path.update'; - - /** - * The DELETE event occurs when a path alias is deleted. - * - * @var string - */ - const DELETE = 'path.delete'; - - /** * The database connection. * * @var \Drupal\Core\Database\Connection @@ -114,7 +92,7 @@ public function save($source, $alias, $langcode = Language::LANGCODE_NOT_SPECIFI $operation = 'update'; } if ($pid) { - $event = $operation == 'update' ? PATH::UPDATE : Path::INSERT; + $event = $operation == 'update' ? PathEvents::UPDATE : PathEvents::INSERT; $this->event_dispatcher->dispatch($event, new PathInsertUpdateEvent($fields)); return $fields; } @@ -159,7 +137,7 @@ public function delete($conditions) { $query->condition($field, $value); } $deleted = $query->execute(); - $this->event_dispatcher->dispatch(Path::DELETE, new PathDeleteEvent($path)); + $this->event_dispatcher->dispatch(PathEvents::DELETE, new PathDeleteEvent($path)); return $deleted; } } diff --git a/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php b/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php index 454c764..1f4ceef 100644 --- a/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php +++ b/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Path; -use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -23,15 +22,13 @@ class PathCRUDSubscriber implements EventSubscriberInterface { protected $aliasManager; /** - * Module handler service. + * Constructs PathCRUDSubscriber object. * - * @var \Drupal\Core\Extension\ModuleHandlerInterface + * @param AliasManagerInterface $alias_manager + * Instance of alias manager that caches alias lookups. */ - protected $moduleHandler; - - public function __construct(AliasManagerInterface $alias_manager, ModuleHandlerInterface $module_handler) { + public function __construct(AliasManagerInterface $alias_manager) { $this->aliasManager = $alias_manager; - $this->moduleHandler = $module_handler; } /** @@ -48,9 +45,9 @@ public function clearAliasManagerCaches() { * An array of event listener definitions. */ static function getSubscribedEvents() { - $events[Path::UPDATE][] = array('clearAliasManagerCaches'); - $events[Path::INSERT][] = array('clearAliasManagerCaches'); - $events[Path::DELETE][] = array('clearAliasManagerCaches'); + $events[PathEvents::UPDATE][] = array('clearAliasManagerCaches'); + $events[PathEvents::INSERT][] = array('clearAliasManagerCaches'); + $events[PathEvents::DELETE][] = array('clearAliasManagerCaches'); return $events; } } diff --git a/core/lib/Drupal/Core/Path/PathEvents.php b/core/lib/Drupal/Core/Path/PathEvents.php new file mode 100644 index 0000000..c2e8db4 --- /dev/null +++ b/core/lib/Drupal/Core/Path/PathEvents.php @@ -0,0 +1,34 @@ +