These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Edit link for the backend. |
||
5 | */ |
||
6 | declare(strict_types = 1); |
||
7 | |||
8 | namespace HDNET\Autoloader\ViewHelpers\Be; |
||
9 | |||
10 | use TYPO3\CMS\Backend\Routing\UriBuilder; |
||
11 | use TYPO3\CMS\Backend\Utility\BackendUtility; |
||
12 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
||
13 | |||
14 | /** |
||
15 | * Edit link for the backend. |
||
16 | */ |
||
17 | class EditLinkViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper |
||
18 | { |
||
19 | /** |
||
20 | * Specifies whether the escaping interceptors should be disabled or enabled for the result of renderChildren() calls within this ViewHelper. |
||
21 | * |
||
22 | * @see isChildrenEscapingEnabled() |
||
23 | * |
||
24 | * Note: If this is NULL the value of $this->escapingInterceptorEnabled is considered for backwards compatibility |
||
25 | * |
||
26 | * @var bool |
||
27 | * |
||
28 | * @api |
||
29 | */ |
||
30 | protected $escapeChildren = false; |
||
31 | |||
32 | /** |
||
33 | * Specifies whether the escaping interceptors should be disabled or enabled for the render-result of this ViewHelper. |
||
34 | * |
||
35 | * @see isOutputEscapingEnabled() |
||
36 | * |
||
37 | * @var bool |
||
38 | * |
||
39 | * @api |
||
40 | */ |
||
41 | protected $escapeOutput = false; |
||
42 | |||
43 | /** |
||
44 | * Init arguments. |
||
45 | */ |
||
46 | public function initializeArguments(): void |
||
47 | { |
||
48 | parent::initializeArguments(); |
||
49 | $this->registerArgument('data', 'array', 'Row of the content element', true, []); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Render a edit link for the backend preview. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function render() |
||
58 | { |
||
59 | $urlParameter = [ |
||
60 | 'edit[tt_content][' . $this->arguments['data']['uid'] . ']' => 'edit', |
||
61 | 'returnUrl' => GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), |
||
62 | ]; |
||
63 | |||
64 | return '<a href="' . $this->getModuleUrl('record_edit', $urlParameter) . '">' . $this->renderChildren() . '</a>'; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * getModuleUrl. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | protected function getModuleUrl(string $moduleName, array $urlParameters) |
||
73 | { |
||
74 | /** @var UriBuilder $uriBuilder */ |
||
75 | $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
||
76 | |||
77 | try { |
||
78 | if (!method_exists($uriBuilder, 'buildUriFromRoute')) { |
||
79 | throw new \Exception('No method', 1238); |
||
80 | } |
||
81 | $uri = $uriBuilder->buildUriFromRoute($moduleName, $urlParameters); |
||
82 | } catch (\Exception $ex) { |
||
83 | // old TYPO3 |
||
84 | $uri = BackendUtility::getModuleUrl('record_edit', $urlParameters); |
||
0 ignored issues
–
show
|
|||
85 | } |
||
86 | |||
87 | return (string)$uri; |
||
88 | } |
||
89 | } |
||
90 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.