TYPO3 CMS  TYPO3_8-7
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 }
static makeInstance($className,... $constructorArguments)