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