‪TYPO3CMS  ‪main
CshViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 
53 {
59  protected ‪$escapeOutput = false;
60 
61  public function ‪initializeArguments(): void
62  {
63  parent::initializeArguments();
64  $this->registerArgument('table', 'string', 'Table name (\'_MOD_\'+module name). If not set, the current module name will be used');
65  $this->registerArgument('field', 'string', 'Field name (CSH locallang main key)', false, '');
66  $this->registerArgument('label', 'string', 'Language label which is wrapped with the CSH', false, '');
67  }
68 
69  public function ‪render(): string
70  {
71  return ‪self::renderStatic($this->arguments, $this->buildRenderChildrenClosure(), $this->renderingContext);
72  }
73 
77  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
78  {
79  trigger_error(
80  __CLASS__ . ' is returning the translated label wrapped in a <label> tag only in TYPO3 v12 and will be removed in TYPO3 v13.0.',
81  E_USER_DEPRECATED
82  );
83 
84  $label = $arguments['label'];
85 
86  $label = ‪self::getLanguageService()->sL($label);
87  return '<label>' . htmlspecialchars($label, ENT_QUOTES, '', true) . '</label>';
88  }
89 
90  protected static function ‪getLanguageService(): ‪LanguageService
91  {
92  return ‪$GLOBALS['LANG'];
93  }
94 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels
Definition: CshViewHelper.php:18
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: CshViewHelper.php:58
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\render
‪render()
Definition: CshViewHelper.php:68
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:30
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\getLanguageService
‪static getLanguageService()
Definition: CshViewHelper.php:89
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\initializeArguments
‪initializeArguments()
Definition: CshViewHelper.php:60
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper\renderStatic
‪static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: CshViewHelper.php:76
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Labels\CshViewHelper
Definition: CshViewHelper.php:53