‪TYPO3CMS  10.4
DistributionController.php
Go to the documentation of this file.
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 
17 
21 use TYPO3\CMS\Core\Package\PackageManager;
24 
30 {
34  protected ‪$packageManager;
35 
39  public function ‪injectPackageManager(PackageManager ‪$packageManager)
40  {
41  $this->packageManager = ‪$packageManager;
42  }
43 
49  protected function ‪initializeView(‪ViewInterface ‪$view)
50  {
51  if (‪$view instanceof ‪BackendTemplateView) {
53  parent::initializeView(‪$view);
54  $this->‪generateMenu();
56  }
57  }
58 
64  public function ‪showAction(‪Extension $extension)
65  {
66  $extensionKey = $extension->‪getExtensionKey();
67  // Check if extension/package is installed
68  $active = $this->packageManager->isPackageActive($extensionKey);
69 
70  $this->view->assign('distributionActive', $active);
71  $this->view->assign('extension', $extension);
72  }
73 
79  protected function ‪registerDocheaderButtons()
80  {
82  $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
83 
84  ‪$uriBuilder = $this->controllerContext->getUriBuilder();
85 
86  $uri = ‪$uriBuilder->‪reset()->uriFor('distributions', [], 'List');
87  $title = $this->‪translate('extConfTemplate.backToList');
88  $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-back', ‪Icon::SIZE_SMALL);
89  $button = $buttonBar->makeLinkButton()
90  ->setHref($uri)
91  ->setTitle($title)
92  ->setIcon($icon);
93  $buttonBar->addButton($button, ‪ButtonBar::BUTTON_POSITION_LEFT);
94  }
95 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_LEFT
‪const BUTTON_POSITION_LEFT
Definition: ButtonBar.php:36
‪TYPO3\CMS\Backend\Template\Components\ButtonBar
Definition: ButtonBar.php:32
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController\translate
‪string translate($key, $arguments=null)
Definition: AbstractController.php:44
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController
Definition: AbstractModuleController.php:27
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension
Definition: Extension.php:29
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\registerDocheaderButtons
‪registerDocheaderButtons()
Definition: DistributionController.php:78
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController\generateMenu
‪generateMenu()
Definition: AbstractModuleController.php:60
‪TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder\reset
‪static reset()
Definition: UriBuilder.php:534
‪TYPO3\CMS\Extensionmanager\Controller
Definition: AbstractController.php:16
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\showAction
‪showAction(Extension $extension)
Definition: DistributionController.php:63
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\injectPackageManager
‪injectPackageManager(PackageManager $packageManager)
Definition: DistributionController.php:38
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController
Definition: DistributionController.php:30
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\$packageManager
‪PackageManager $packageManager
Definition: DistributionController.php:33
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$uriBuilder
‪TYPO3 CMS Extbase Mvc Web Routing UriBuilder $uriBuilder
Definition: ActionController.php:127
‪TYPO3\CMS\Extensionmanager\Controller\DistributionController\initializeView
‪initializeView(ViewInterface $view)
Definition: DistributionController.php:48
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension\getExtensionKey
‪string getExtensionKey()
Definition: Extension.php:270
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface
Definition: ViewInterface.php:24
‪TYPO3\CMS\Backend\View\BackendTemplateView
Definition: BackendTemplateView.php:28
‪TYPO3\CMS\Extensionmanager\Controller\AbstractModuleController\$view
‪BackendTemplateView $view
Definition: AbstractModuleController.php:32