‪TYPO3CMS  9.5
MailLinkHandler.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 
17 use Psr\Http\Message\ServerRequestInterface;
20 
26 {
32  protected ‪$linkParts = [];
33 
39  protected ‪$updateSupported = false;
40 
44  public function ‪__construct()
45  {
46  parent::__construct();
47  // remove unsupported link attributes
48  foreach (['target', 'rel'] as $attribute) {
49  $position = array_search($attribute, $this->linkAttributes, true);
50  if ($position !== false) {
51  unset($this->linkAttributes[$position]);
52  }
53  }
54  }
55 
65  public function ‪canHandleLink(array ‪$linkParts)
66  {
67  if (isset(‪$linkParts['url']['email'])) {
68  $this->linkParts = ‪$linkParts;
69  return true;
70  }
71  return false;
72  }
73 
79  public function ‪formatCurrentUrl()
80  {
81  return $this->linkParts['url']['email'];
82  }
83 
91  public function ‪render(ServerRequestInterface $request)
92  {
93  GeneralUtility::makeInstance(PageRenderer::class)->loadRequireJsModule('TYPO3/CMS/Recordlist/MailLinkHandler');
94 
95  $this->view->assign('email', !empty($this->linkParts) ? $this->linkParts['url']['email'] : '');
96  return $this->view->render('Mail');
97  }
98 
102  public function ‪getBodyTagAttributes()
103  {
104  return [];
105  }
106 }
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:35
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45