‪TYPO3CMS  ‪main
DispatchNotificationHook.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
28 {
35  public function ‪dispatchNotification(&$params)
36  {
37  $javaScriptRenderer = GeneralUtility::makeInstance(PageRenderer::class)->getJavaScriptRenderer();
38  $javaScriptRenderer->addJavaScriptModuleInstruction(
39  // @todo refactor to directly invoke the redirects slugChanged() method
40  // instead of dispatching an event that is only catched by the event dispatcher itself
41  ‪JavaScriptModuleInstruction::create('@typo3/redirects/event-handler.js')
43  ->invoke('dispatchCustomEvent', 'typo3:redirects:slugChanged', $params['parameter'])
44  );
45  // not modifying `$params`, since instruction is added to global `PageRenderer`
46  }
47 }
‪TYPO3\CMS\Redirects\Hooks\DispatchNotificationHook
Definition: DispatchNotificationHook.php:28
‪TYPO3\CMS\Redirects\Hooks\DispatchNotificationHook\dispatchNotification
‪dispatchNotification(&$params)
Definition: DispatchNotificationHook.php:35
‪TYPO3\CMS\Redirects\Hooks
Definition: DataHandlerCacheFlushingHook.php:18
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction\create
‪static create(string $name, string $exportName=null)
Definition: JavaScriptModuleInstruction.php:47
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction
Definition: JavaScriptModuleInstruction.php:23
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:44
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction\FLAG_USE_TOP_WINDOW
‪const FLAG_USE_TOP_WINDOW
Definition: JavaScriptModuleInstruction.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52