TYPO3  7.6
LiveSearchToolbarItem.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 
22 
27 {
31  public function __construct()
32  {
33  $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LiveSearch');
34  }
35 
42  public function checkAccess()
43  {
45  $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
48  // Live search is heavily dependent on the list module and only available when that module is.
49  $listModule = $backendModuleRepository->findByModuleName('web_list');
50  return $listModule !== null;
51  }
52 
58  public function getItem()
59  {
60  return '
61  <form class="typo3-topbar-navigation-search t3js-topbar-navigation-search live-search-wrapper" role="search">
62  <div class="form-group">
63  <input type="text" class="form-control t3js-topbar-navigation-search-field" placeholder="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.search', true) . '" id="live-search-box" autocomplete="off">
64  </div>
65  </form>
66  <div class="dropdown-menu" role="menu"></div>
67  ';
68  }
69 
75  public function getAdditionalAttributes()
76  {
77  return array('class' => 'dropdown');
78  }
79 
85  public function hasDropDown()
86  {
87  return false;
88  }
89 
95  public function getDropDown()
96  {
97  return '';
98  }
99 
105  public function getIndex()
106  {
107  return 90;
108  }
109 
115  protected function getPageRenderer()
116  {
117  return GeneralUtility::makeInstance(PageRenderer::class);
118  }
119 
125  protected function getLanguageService()
126  {
127  return $GLOBALS['LANG'];
128  }
129 }