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