‪TYPO3CMS  9.5
TriggerViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
35 {
39  public function ‪initializeArguments()
40  {
41  parent::initializeArguments();
42  $this->registerArgument('triggers', 'array', 'Defined triggers to be forwarded to client (e.g. refreshing backend widgets)', false, []);
43  }
44 
53  public function ‪render()
54  {
55  $pageRenderer = $this->‪getPageRenderer();
56  // Handle triggers
57  if (!empty($this->arguments['triggers'][‪AbstractController::TRIGGER_RefreshModuleMenu])) {
58  $pageRenderer->addJsInlineCode(
60  'if (top && top.TYPO3.ModuleMenu.App) { top.TYPO3.ModuleMenu.App.refreshMenu(); }'
61  );
62  }
63 
64  if (!empty($this->arguments['triggers'][‪AbstractController::TRIGGER_RefreshTopbar])) {
65  $pageRenderer->addJsInlineCode(
67  'if (top && top.TYPO3.Backend && top.TYPO3.Backend.Topbar) { top.TYPO3.Backend.Topbar.refresh(); }'
68  );
69  }
70  return '';
71  }
72 }
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\initializeArguments
‪initializeArguments()
Definition: TriggerViewHelper.php:39
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper\getPageRenderer
‪PageRenderer getPageRenderer()
Definition: AbstractBackendViewHelper.php:54
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\render
‪string render()
Definition: TriggerViewHelper.php:53
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be
Definition: TriggerViewHelper.php:2
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:27
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper
Definition: TriggerViewHelper.php:35
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\TRIGGER_RefreshModuleMenu
‪const TRIGGER_RefreshModuleMenu
Definition: AbstractController.php:23
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\TRIGGER_RefreshTopbar
‪const TRIGGER_RefreshTopbar
Definition: AbstractController.php:25
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController
Definition: AbstractController.php:22