[FEATURE] Allow extended custom links in FormEngine and TypoLink
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Typolink / UnableToLinkException.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Frontend\Typolink;
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
18 use TYPO3\CMS\Frontend\Exception;
19
20 /**
21 * Exception which is thrown when a link could not be set
22 */
23 class UnableToLinkException extends Exception
24 {
25 /**
26 * @var string the text which should have gone inside the
27 */
28 protected $linkText;
29
30 /**
31 * Constructor the exception. With an additional parameter for the link text
32 *
33 * @param string $message [optional] The Exception message to throw.
34 * @param int $code [optional] The Exception code.
35 * @param \Throwable $previous [optional] The previous throwable used for the exception chaining.
36 * @param string $linkText
37 */
38 public function __construct($message = '', $code = 0, \Throwable $previous = null, $linkText = null)
39 {
40 parent::__construct($message, $code, $previous);
41 $this->linkText = $linkText;
42 }
43
44 /**
45 * Returns the link text when the link could not been set
46 *
47 * @return string
48 */
49 public function getLinkText(): string
50 {
51 return $this->linkText;
52 }
53 }