‪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 
21 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
22 
50 {
56  protected ‪$escapeOutput = false;
57 
62  protected static function ‪getLanguageService()
63  {
64  return ‪$GLOBALS['LANG'];
65  }
66 
72  public function ‪initializeArguments()
73  {
74  parent::initializeArguments();
75  $this->registerArgument('table', 'string', 'Table name (\'_MOD_\'+module name). If not set, the current module name will be used');
76  $this->registerArgument('field', 'string', 'Field name (CSH locallang main key)', false, '');
77  $this->registerArgument('label', 'string', 'Language label which is wrapped with the CSH', false, '');
78  }
79 
85  public function ‪render()
86  {
87  return static::renderStatic(
88  $this->arguments,
89  $this->buildRenderChildrenClosure(),
90  $this->renderingContext
91  );
92  }
93 
100  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
101  {
102  $table = $arguments['table'];
103  $field = $arguments['field'];
104  $label = $arguments['label'];
105 
106  if ($table === null) {
107  $currentRequest = $renderingContext->getControllerContext()->getRequest();
108  $moduleName = $currentRequest->getPluginName();
109  $table = '_MOD_' . $moduleName;
110  }
111  if (strpos($label, 'LLL:') === 0) {
112  $label = ‪self::getLanguageService()->‪sL($label);
113  }
114  // Double encode can be set to true, once the typo3fluid/fluid fix is released and required
115  $label = '<label>' . htmlspecialchars($label, ENT_QUOTES, null, false) . '</label>';
116  return ‪BackendUtility::wrapInHelp($table, $field, $label);
117  }
118 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels
Definition: CshViewHelper.php:16
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: CshViewHelper.php:55
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: CshViewHelper.php:99
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:28
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapInHelp
‪static string wrapInHelp($table, $field, $text='', array $overloadHelpText=[])
Definition: BackendUtility.php:2260
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\getLanguageService
‪static LanguageService getLanguageService()
Definition: CshViewHelper.php:61
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\render
‪string render()
Definition: CshViewHelper.php:84
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\initializeArguments
‪initializeArguments()
Definition: CshViewHelper.php:71
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper
Definition: CshViewHelper.php:50