TYPO3 CMS  TYPO3_8-7
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(
59  AbstractController::TRIGGER_RefreshModuleMenu,
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(
66  AbstractController::TRIGGER_RefreshTopbar,
67  'if (top && top.TYPO3.Backend && top.TYPO3.Backend.Topbar) { top.TYPO3.Backend.Topbar.refresh(); }'
68  );
69  }
70  return '';
71  }
72 }