‪TYPO3CMS  10.4
TriggerViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
37 {
41  protected ‪$escapeOutput = false;
42 
46  public function ‪initializeArguments()
47  {
48  parent::initializeArguments();
49  $this->registerArgument('triggers', 'array', 'Defined triggers to be forwarded to client (e.g. refreshing backend widgets)', false, []);
50  }
51 
58  public function ‪render()
59  {
60  $html = '';
61  // Handle triggers
62  $triggers = $this->arguments['triggers'] ?? [];
63  if (!empty($triggers[‪AbstractController::TRIGGER_RefreshModuleMenu])) {
64  $html .= $this->‪buildInstructionDataTag('TYPO3.ModuleMenu.App.refreshMenu');
65  }
66  if (!empty($triggers[‪AbstractController::TRIGGER_RefreshTopbar])) {
67  $html .= $this->‪buildInstructionDataTag('TYPO3.Backend.Topbar.refresh');
68  }
69  return $html;
70  }
71 
72  protected function ‪buildInstructionDataTag(string $dispatchAction): string
73  {
74  return sprintf(
75  '<typo3-immediate-action action="%s"></typo3-immediate-action>' . "\n",
76  htmlspecialchars($dispatchAction)
77  );
78  }
79 }
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\initializeArguments
‪initializeArguments()
Definition: TriggerViewHelper.php:45
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\render
‪string render()
Definition: TriggerViewHelper.php:57
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be
Definition: TriggerViewHelper.php:16
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:28
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper
Definition: TriggerViewHelper.php:37
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\TRIGGER_RefreshModuleMenu
‪const TRIGGER_RefreshModuleMenu
Definition: AbstractController.php:27
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: TriggerViewHelper.php:40
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\TRIGGER_RefreshTopbar
‪const TRIGGER_RefreshTopbar
Definition: AbstractController.php:28
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController
Definition: AbstractController.php:26
‪TYPO3\CMS\Extensionmanager\ViewHelpers\Be\TriggerViewHelper\buildInstructionDataTag
‪buildInstructionDataTag(string $dispatchAction)
Definition: TriggerViewHelper.php:71