‪TYPO3CMS  10.4
EmailViewHelper.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 
18 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
20 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
21 
41 class ‪EmailViewHelper extends AbstractViewHelper
42 {
43  use CompileWithRenderStatic;
44 
48  public function ‪initializeArguments()
49  {
50  $this->registerArgument('email', 'string', 'The email address to be turned into a URI', true);
51  }
52 
60  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
61  {
62  $email = $arguments['email'];
63 
64  if (TYPO3_MODE === 'FE') {
65  $emailParts = ‪$GLOBALS['TSFE']->cObj->getMailTo($email, $email);
66  return reset($emailParts);
67  }
68  return 'mailto:' . $email;
69  }
70 }
‪TYPO3\CMS\Fluid\ViewHelpers\Uri\EmailViewHelper\initializeArguments
‪initializeArguments()
Definition: EmailViewHelper.php:47
‪TYPO3\CMS\Fluid\ViewHelpers\Uri\EmailViewHelper
Definition: EmailViewHelper.php:42
‪TYPO3\CMS\Fluid\ViewHelpers\Uri\EmailViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: EmailViewHelper.php:59
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Fluid\ViewHelpers\Uri
Definition: ActionViewHelper.php:16