‪TYPO3CMS  9.5
DistributionController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
20 
26 {
30  protected ‪$packageManager;
31 
35  public function ‪injectPackageManager(\‪TYPO3\CMS\Core\Package\PackageManager ‪$packageManager)
36  {
37  $this->packageManager = ‪$packageManager;
38  }
39 
45  protected function ‪initializeView(‪ViewInterface ‪$view)
46  {
47  if (‪$view instanceof ‪BackendTemplateView) {
49  parent::initializeView(‪$view);
50  $this->‪generateMenu();
52  }
53  }
54 
60  public function ‪showAction(\‪TYPO3\CMS\Extensionmanager\Domain\Model\‪Extension $extension)
61  {
62  $extensionKey = $extension->getExtensionKey();
63  // Check if extension/package is installed
64  $active = $this->packageManager->isPackageActive($extensionKey);
65 
66  $this->view->assign('distributionActive', $active);
67  $this->view->assign('extension', $extension);
68  }
69 
75  protected function ‪registerDocheaderButtons()
76  {
78  $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
79 
80  ‪$uriBuilder = $this->controllerContext->getUriBuilder();
81 
82  $uri = ‪$uriBuilder->reset()->uriFor('distributions', [], 'List');
83  $title = $this->‪translate('extConfTemplate.backToList');
84  $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-back', ‪Icon::SIZE_SMALL);
85  $button = $buttonBar->makeLinkButton()
86  ->setHref($uri)
87  ->setTitle($title)
88  ->setIcon($icon);
89  $buttonBar->addButton($button, ‪ButtonBar::BUTTON_POSITION_LEFT);
90  }
91 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_LEFT
‪const BUTTON_POSITION_LEFT
Definition: ButtonBar.php:35
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\translate
‪string null translate($key, $arguments=null)
Definition: AbstractController.php:41
‪TYPO3\CMS\Backend\Template\Components\ButtonBar
Definition: ButtonBar.php:31
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController
Definition: AbstractModuleController.php:25
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension
Definition: Extension.php:24
‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$uriBuilder
‪TYPO3 CMS Extbase Mvc Web Routing UriBuilder $uriBuilder
Definition: AbstractController.php:37
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\registerDocheaderButtons
‪registerDocheaderButtons()
Definition: DistributionController.php:74
‪TYPO3
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController\generateMenu
‪generateMenu()
Definition: AbstractModuleController.php:58
‪TYPO3\CMS\Extensionmanager\Controller
Definition: AbstractController.php:2
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController
Definition: DistributionController.php:26
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\$packageManager
‪TYPO3 CMS Core Package PackageManager $packageManager
Definition: DistributionController.php:29
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\injectPackageManager
‪injectPackageManager(\TYPO3\CMS\Core\Package\PackageManager $packageManager)
Definition: DistributionController.php:34
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\initializeView
‪initializeView(ViewInterface $view)
Definition: DistributionController.php:44
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface
Definition: ViewInterface.php:21
‪TYPO3\CMS\Backend\View\BackendTemplateView
Definition: BackendTemplateView.php:27
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController\$view
‪BackendTemplateView $view
Definition: AbstractModuleController.php:30
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\showAction
‪showAction(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
Definition: DistributionController.php:59