‪TYPO3CMS  10.4
LiveSearchToolbarItem.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  public function ‪__construct()
33  {
34  $this->‪getPageRenderer()->‪loadRequireJsModule('TYPO3/CMS/Backend/LiveSearch');
35  }
36 
44  public function ‪checkAccess()
45  {
46  $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
47  $listModule = $backendModuleRepository->findByModuleName('web_list');
48  return $listModule !== null && $listModule !== false;
49  }
50 
56  public function ‪getItem()
57  {
58  return $this->‪getFluidTemplateObject('LiveSearchToolbarItem.html')->‪render();
59  }
60 
66  public function ‪getAdditionalAttributes()
67  {
68  return ['class' => 'toolbar-item-search t3js-toolbar-item-search'];
69  }
70 
76  public function ‪hasDropDown()
77  {
78  return false;
79  }
80 
86  public function ‪getDropDown()
87  {
88  return '';
89  }
90 
96  public function ‪getIndex()
97  {
98  return 90;
99  }
100 
106  protected function ‪getPageRenderer()
107  {
108  return GeneralUtility::makeInstance(PageRenderer::class);
109  }
110 
117  protected function ‪getFluidTemplateObject(string $filename): ‪StandaloneView
118  {
119  $view = GeneralUtility::makeInstance(StandaloneView::class);
120  $view->setLayoutRootPaths(['EXT:backend/Resources/Private/Layouts']);
121  $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/ToolbarItems']);
122  $view->setTemplateRootPaths(['EXT:backend/Resources/Private/Templates/ToolbarItems']);
123 
124  $view->setTemplate($filename);
125 
126  $view->getRequest()->setControllerExtensionName('Backend');
127  return $view;
128  }
129 }
‪TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface
Definition: ToolbarItemInterface.php:25
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem
Definition: LiveSearchToolbarItem.php:28
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\checkAccess
‪bool checkAccess()
Definition: LiveSearchToolbarItem.php:44
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getDropDown
‪string getDropDown()
Definition: LiveSearchToolbarItem.php:86
‪TYPO3\CMS\Core\Page\PageRenderer\loadRequireJsModule
‪loadRequireJsModule($mainModuleName, $callBackFunction=null)
Definition: PageRenderer.php:1493
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:42
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getAdditionalAttributes
‪array getAdditionalAttributes()
Definition: LiveSearchToolbarItem.php:66
‪TYPO3\CMS\Backend\Backend\ToolbarItems
Definition: ClearCacheToolbarItem.php:16
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getFluidTemplateObject
‪StandaloneView getFluidTemplateObject(string $filename)
Definition: LiveSearchToolbarItem.php:117
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getItem
‪string getItem()
Definition: LiveSearchToolbarItem.php:56
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getIndex
‪int getIndex()
Definition: LiveSearchToolbarItem.php:96
‪TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository
Definition: BackendModuleRepository.php:34
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\getPageRenderer
‪PageRenderer getPageRenderer()
Definition: LiveSearchToolbarItem.php:106
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:34
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface\render
‪string render()
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\__construct
‪__construct()
Definition: LiveSearchToolbarItem.php:32
‪TYPO3\CMS\Backend\Backend\ToolbarItems\LiveSearchToolbarItem\hasDropDown
‪bool hasDropDown()
Definition: LiveSearchToolbarItem.php:76