‪TYPO3CMS  9.5
HelpToolbarItem.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  */
16 
22 
27 {
31  protected ‪$helpModuleMenu;
32 
36  public function ‪__construct()
37  {
38  $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
39  ‪$helpModuleMenu = $backendModuleRepository->findByModuleName('help');
40  if (‪$helpModuleMenu && ‪$helpModuleMenu->‪getChildren()->count() > 0) {
41  $this->helpModuleMenu = ‪$helpModuleMenu;
42  }
43  }
44 
50  public function ‪checkAccess()
51  {
52  return (bool)‪$this->helpModuleMenu;
53  }
54 
60  public function ‪getItem()
61  {
62  return $this->‪getFluidTemplateObject('HelpToolbarItem.html')->‪render();
63  }
64 
70  public function ‪getDropDown()
71  {
72  $view = $this->‪getFluidTemplateObject('HelpToolbarItemDropDown.html');
73  $view->assign('modules', $this->helpModuleMenu->getChildren());
74  return $view->render();
75  }
76 
82  public function ‪getAdditionalAttributes()
83  {
84  return [];
85  }
86 
92  public function ‪hasDropDown()
93  {
94  return true;
95  }
96 
102  public function ‪getIndex()
103  {
104  return 70;
105  }
106 
113  protected function ‪getFluidTemplateObject(string $filename): ‪StandaloneView
114  {
115  $view = GeneralUtility::makeInstance(StandaloneView::class);
116  $view->setLayoutRootPaths(['EXT:backend/Resources/Private/Layouts']);
117  $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/ToolbarItems']);
118  $view->setTemplateRootPaths(['EXT:backend/Resources/Private/Templates/ToolbarItems']);
119  $view->setTemplate($filename);
120 
121  $view->getRequest()->setControllerExtensionName('Backend');
122  return $view;
123  }
124 }
‪TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface
Definition: ToolbarItemInterface.php:24
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\__construct
‪__construct()
Definition: HelpToolbarItem.php:35
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem
Definition: HelpToolbarItem.php:27
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\getAdditionalAttributes
‪array getAdditionalAttributes()
Definition: HelpToolbarItem.php:81
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\getFluidTemplateObject
‪StandaloneView getFluidTemplateObject(string $filename)
Definition: HelpToolbarItem.php:112
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\getIndex
‪int getIndex()
Definition: HelpToolbarItem.php:101
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\checkAccess
‪bool checkAccess()
Definition: HelpToolbarItem.php:49
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\getItem
‪string getItem()
Definition: HelpToolbarItem.php:59
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\$helpModuleMenu
‪BackendModule $helpModuleMenu
Definition: HelpToolbarItem.php:30
‪TYPO3\CMS\Backend\Backend\ToolbarItems
Definition: ClearCacheToolbarItem.php:2
‪TYPO3\CMS\Backend\Domain\Model\Module\BackendModule\getChildren
‪SplObjectStorage getChildren()
Definition: BackendModule.php:89
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\getDropDown
‪string getDropDown()
Definition: HelpToolbarItem.php:69
‪TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository
Definition: BackendModuleRepository.php:30
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Backend\Domain\Model\Module\BackendModule
Definition: BackendModule.php:21
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface\render
‪string render()
‪TYPO3\CMS\Backend\Backend\ToolbarItems\HelpToolbarItem\hasDropDown
‪bool hasDropDown()
Definition: HelpToolbarItem.php:91
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45