‪TYPO3CMS  10.4
CshViewHelper.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 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
21 
57 {
63  protected ‪$escapeOutput = false;
64 
70  public function ‪initializeArguments()
71  {
72  parent::initializeArguments();
73  $this->registerArgument('table', 'string', 'Table name (\'_MOD_\'+module name). If not set, the current module name will be used');
74  $this->registerArgument('field', 'string', 'Field name (CSH locallang main key)', false, '');
75  $this->registerArgument('wrap', 'string', 'Markup to wrap around the CSH, split by "|"', false, '');
76  }
77 
83  public function ‪render()
84  {
85  return static::renderStatic(
86  $this->arguments,
87  $this->buildRenderChildrenClosure(),
88  $this->renderingContext
89  );
90  }
91 
98  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
99  {
100  $table = $arguments['table'];
101  $field = $arguments['field'];
102  $wrap = $arguments['wrap'];
103 
104  if ($table === null) {
105  $currentRequest = $renderingContext->getControllerContext()->getRequest();
106  $moduleName = $currentRequest->getPluginName();
107  $table = '_MOD_' . $moduleName;
108  }
109  $content = (string)$renderChildrenClosure();
110  if ($content !== '') {
111  return ‪BackendUtility::wrapInHelp($table, $field, $content);
112  }
113 
114  return '<div class="docheader-csh">' . ‪BackendUtility::cshItem($table, $field, '', $wrap) . '</div>';
115  }
116 }
‪TYPO3\CMS\Backend\Utility\BackendUtility\cshItem
‪static string cshItem($table, $field, $_='', $wrap='')
Definition: BackendUtility.php:2306
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper\render
‪string render()
Definition: CshViewHelper.php:82
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: CshViewHelper.php:97
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:28
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapInHelp
‪static string wrapInHelp($table, $field, $text='', array $overloadHelpText=[])
Definition: BackendUtility.php:2260
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper\initializeArguments
‪initializeArguments()
Definition: CshViewHelper.php:69
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: CshViewHelper.php:62
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper
Definition: CshViewHelper.php:57
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons
Definition: CshViewHelper.php:16