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