TYPO3 CMS  TYPO3_8-7
ProcessAvailableActionsViewHelper.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 
23 {
24  const SIGNAL_ProcessActions = 'processActions';
25 
30 
34  public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
35  {
36  $this->signalSlotDispatcher = $signalSlotDispatcher;
37  }
38 
42  public function initializeArguments()
43  {
44  parent::initializeArguments();
45  $this->registerArgument('extension', 'string', '', true);
46  }
47 
53  public function render()
54  {
55  $extension = $this->arguments['extension'];
56  $html = $this->renderChildren();
57  $actions = preg_split('#\\n\\s*#s', trim($html));
58 
59  $actions = $this->emitProcessActionsSignal($extension, $actions);
60 
61  return implode(' ', $actions);
62  }
63 
71  protected function emitProcessActionsSignal($extension, array $actions)
72  {
73  $this->signalSlotDispatcher->dispatch(
74  __CLASS__,
75  static::SIGNAL_ProcessActions,
76  [
77  $extension,
78  &$actions,
79  ]
80  );
81  return $actions;
82  }
83 }
injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)