‪TYPO3CMS  11.5
TelephoneLinkHandler.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 
20 use Psr\Http\Message\ServerRequestInterface;
21 
27 {
33  protected ‪$linkParts = [];
34 
40  protected ‪$updateSupported = false;
41 
45  public function ‪__construct()
46  {
47  parent::__construct();
48  // remove unsupported link attributes
49  foreach (['target', 'rel'] as $attribute) {
50  $position = array_search($attribute, $this->linkAttributes, true);
51  if ($position !== false) {
52  unset($this->linkAttributes[$position]);
53  }
54  }
55  }
56 
66  public function ‪canHandleLink(array ‪$linkParts): bool
67  {
68  if (isset(‪$linkParts['url']['telephone'])) {
69  $this->linkParts = ‪$linkParts;
70  return true;
71  }
72  return false;
73  }
74 
80  public function ‪formatCurrentUrl(): string
81  {
82  return $this->linkParts['url']['telephone'];
83  }
84 
92  public function ‪render(ServerRequestInterface $request): string
93  {
94  $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/TelephoneLinkHandler');
95  $this->view->assign('telephone', !empty($this->linkParts) ? $this->linkParts['url']['telephone'] : '');
96  $this->view->setTemplate('Telephone');
97  return '';
98  }
99 
103  public function ‪getBodyTagAttributes(): array
104  {
105  return [];
106  }
107 }