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