| @@ 46-78 (lines=33) @@ | ||
| 43 | $this->eventDispatcher = $eventDispatcher; |
|
| 44 | } |
|
| 45 | ||
| 46 | public function createUrlAlias( |
|
| 47 | Location $location, |
|
| 48 | $path, |
|
| 49 | $languageCode, |
|
| 50 | $forwarding = false, |
|
| 51 | $alwaysAvailable = false |
|
| 52 | ) { |
|
| 53 | $eventData = [ |
|
| 54 | $location, |
|
| 55 | $path, |
|
| 56 | $languageCode, |
|
| 57 | $forwarding, |
|
| 58 | $alwaysAvailable, |
|
| 59 | ]; |
|
| 60 | ||
| 61 | $beforeEvent = new BeforeCreateUrlAliasEvent(...$eventData); |
|
| 62 | ||
| 63 | $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateUrlAliasEventInterface::class); |
|
| 64 | if ($beforeEvent->isPropagationStopped()) { |
|
| 65 | return $beforeEvent->getUrlAlias(); |
|
| 66 | } |
|
| 67 | ||
| 68 | $urlAlias = $beforeEvent->hasUrlAlias() |
|
| 69 | ? $beforeEvent->getUrlAlias() |
|
| 70 | : $this->innerService->createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable); |
|
| 71 | ||
| 72 | $this->eventDispatcher->dispatch( |
|
| 73 | new CreateUrlAliasEvent($urlAlias, ...$eventData), |
|
| 74 | CreateUrlAliasEventInterface::class |
|
| 75 | ); |
|
| 76 | ||
| 77 | return $urlAlias; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function createGlobalUrlAlias( |
|
| 81 | $resource, |
|
| @@ 80-112 (lines=33) @@ | ||
| 77 | return $urlAlias; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function createGlobalUrlAlias( |
|
| 81 | $resource, |
|
| 82 | $path, |
|
| 83 | $languageCode, |
|
| 84 | $forwarding = false, |
|
| 85 | $alwaysAvailable = false |
|
| 86 | ) { |
|
| 87 | $eventData = [ |
|
| 88 | $resource, |
|
| 89 | $path, |
|
| 90 | $languageCode, |
|
| 91 | $forwarding, |
|
| 92 | $alwaysAvailable, |
|
| 93 | ]; |
|
| 94 | ||
| 95 | $beforeEvent = new BeforeCreateGlobalUrlAliasEvent(...$eventData); |
|
| 96 | ||
| 97 | $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateGlobalUrlAliasEventInterface::class); |
|
| 98 | if ($beforeEvent->isPropagationStopped()) { |
|
| 99 | return $beforeEvent->getUrlAlias(); |
|
| 100 | } |
|
| 101 | ||
| 102 | $urlAlias = $beforeEvent->hasUrlAlias() |
|
| 103 | ? $beforeEvent->getUrlAlias() |
|
| 104 | : $this->innerService->createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable); |
|
| 105 | ||
| 106 | $this->eventDispatcher->dispatch( |
|
| 107 | new CreateGlobalUrlAliasEvent($urlAlias, ...$eventData), |
|
| 108 | CreateGlobalUrlAliasEventInterface::class |
|
| 109 | ); |
|
| 110 | ||
| 111 | return $urlAlias; |
|
| 112 | } |
|
| 113 | ||
| 114 | public function removeAliases(array $aliasList): void |
|
| 115 | { |
|