TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
HelpToolbarItem.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
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 
23 
28 {
32  protected $helpModuleMenu = null;
33 
37  protected $iconFactory;
38 
42  public function __construct()
43  {
45  $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
47  $helpModuleMenu = $backendModuleRepository->findByModuleName('help');
48  if ($helpModuleMenu && $helpModuleMenu->getChildren()->count() > 0) {
49  $this->helpModuleMenu = $helpModuleMenu;
50  }
51  $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
52  }
53 
59  public function checkAccess()
60  {
61  $result = (bool)$this->helpModuleMenu;
62  return $result;
63  }
64 
70  public function getItem()
71  {
72  $icon = $this->iconFactory->getIcon('apps-toolbar-menu-help', Icon::SIZE_SMALL)->render('inline');
73 
74  $view = $this->getFluidTemplateObject('HelpToolbarItem.html');
75  $view->assignMultiple([
76  'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.help',
77  'icon' => $icon
78  ]
79  );
80 
81  return $view->render();
82  }
83 
89  public function getDropDown()
90  {
91  $view = $this->getFluidTemplateObject('HelpToolbarItemDropDown.html');
92  $view->assignMultiple([
93  'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.clearCache_clearCache',
94  'modules' => $this->helpModuleMenu->getChildren()
95  ]
96  );
97 
98  return $view->render();
99  }
100 
106  public function getAdditionalAttributes()
107  {
108  return [];
109  }
110 
116  public function hasDropDown()
117  {
118  return true;
119  }
120 
126  public function getIndex()
127  {
128  return 70;
129  }
130 
136  protected function getLanguageService()
137  {
138  return $GLOBALS['LANG'];
139  }
140 
148  protected function getFluidTemplateObject(string $filename):StandaloneView
149  {
151  $view = GeneralUtility::makeInstance(StandaloneView::class);
152  $view->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Layouts')]);
153  $view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials/ToolbarItems')]);
154  $view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/ToolbarItems')]);
155 
156  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/ToolbarItems/' . $filename));
157 
158  $view->getRequest()->setControllerExtensionName('Backend');
159  return $view;
160  }
161 }
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)
static getFileAbsFileName($filename, $_=null, $_2=null)