4 * This file is part of the TYPO3 CMS project.
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.
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
13 * The TYPO3 project - inspiring people to share!
16 namespace TYPO3\CMS\Extensionmanager\Controller
;
18 use TYPO3\CMS\Backend\Template\Components\ButtonBar
;
19 use TYPO3\CMS\Backend\View\BackendTemplateView
;
20 use TYPO3\CMS\Core\Imaging\Icon
;
21 use TYPO3\CMS\Core\Package\PackageManager
;
22 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface
;
23 use TYPO3\CMS\Extensionmanager\Domain\Model\Extension
;
26 * Controller for distribution related actions
27 * @internal This class is a specific controller implementation and is not considered part of the Public TYPO3 API.
29 class DistributionController
extends AbstractModuleController
34 protected $packageManager;
37 * @param PackageManager $packageManager
39 public function injectPackageManager(PackageManager
$packageManager)
41 $this->packageManager
= $packageManager;
45 * Set up the doc header properly here
47 * @param ViewInterface $view
49 protected function initializeView(ViewInterface
$view)
51 if ($view instanceof BackendTemplateView
) {
52 /** @var BackendTemplateView $view */
53 parent
::initializeView($view);
54 $this->generateMenu();
55 $this->registerDocheaderButtons();
60 * Shows information about the distribution
62 * @param Extension $extension
64 public function showAction(Extension
$extension)
66 $extensionKey = $extension->getExtensionKey();
67 // Check if extension/package is installed
68 $active = $this->packageManager
->isPackageActive($extensionKey);
70 $this->view
->assign('distributionActive', $active);
71 $this->view
->assign('extension', $extension);
75 * Registers the Icons into the docheader
77 * @throws \InvalidArgumentException
79 protected function registerDocheaderButtons()
81 /** @var ButtonBar $buttonBar */
82 $buttonBar = $this->view
->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
84 $uri = $this->uriBuilder
->reset()->uriFor('distributions', [], 'List');
85 $title = $this->translate('extConfTemplate.backToList');
86 $icon = $this->view
->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-back', Icon
::SIZE_SMALL
);
87 $button = $buttonBar->makeLinkButton()
91 $buttonBar->addButton($button, ButtonBar
::BUTTON_POSITION_LEFT
);