|
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
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Extensionmanager\ViewHelpers; |
|
17
|
|
|
|
|
18
|
|
|
use TYPO3\CMS\Core\Imaging\Icon; |
|
19
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
|
20
|
|
|
use TYPO3\CMS\Core\Package\PackageManager; |
|
21
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
22
|
|
|
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; |
|
23
|
|
|
use TYPO3\CMS\Fluid\ViewHelpers\Link\ActionViewHelper; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Display a deactivate / activate link |
|
27
|
|
|
* @internal |
|
28
|
|
|
*/ |
|
29
|
|
|
class ToggleExtensionInstallationStateViewHelper extends ActionViewHelper |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $tagName = 'a'; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Initialize arguments |
|
38
|
|
|
*/ |
|
39
|
|
|
public function initializeArguments() |
|
40
|
|
|
{ |
|
41
|
|
|
parent::initializeArguments(); |
|
42
|
|
|
$this->registerArgument('extension', 'array', '', true); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Renders an install link |
|
47
|
|
|
* |
|
48
|
|
|
* @return string the rendered a tag |
|
49
|
|
|
*/ |
|
50
|
|
|
public function render() |
|
51
|
|
|
{ |
|
52
|
|
|
$extension = $this->arguments['extension']; |
|
53
|
|
|
// Early return if package is protected and can not be unloaded |
|
54
|
|
|
$packageManager = GeneralUtility::makeInstance(PackageManager::class); |
|
55
|
|
|
$package = $packageManager->getPackage($extension['key']); |
|
56
|
|
|
if ($package->isProtected()) { |
|
57
|
|
|
return ''; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder(); |
|
|
|
|
|
|
61
|
|
|
$action = 'toggleExtensionInstallationState'; |
|
62
|
|
|
$uri = $uriBuilder->reset()->uriFor($action, [ |
|
63
|
|
|
'extensionKey' => $extension['key'] |
|
64
|
|
|
], 'Action'); |
|
65
|
|
|
$this->tag->addAttribute('href', $uri); |
|
66
|
|
|
$label = $extension['installed'] ? 'deactivate' : 'activate'; |
|
67
|
|
|
$this->tag->addAttribute('title', LocalizationUtility::translate('extensionList.' . $label, 'extensionmanager')); |
|
68
|
|
|
$icon = $extension['installed'] ? 'uninstall' : 'install'; |
|
69
|
|
|
$this->tag->addAttribute('class', 'onClickMaskExtensionManager btn btn-default'); |
|
70
|
|
|
|
|
71
|
|
|
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); |
|
72
|
|
|
$this->tag->setContent($iconFactory->getIcon('actions-system-extension-' . $icon, Icon::SIZE_SMALL)->render()); |
|
73
|
|
|
return $this->tag->render(); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
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.