TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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 
24 
29 {
33  protected $iconFactory;
34 
38  public function __construct()
39  {
40  $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LiveSearch');
41  $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
42  }
43 
50  public function checkAccess()
51  {
53  $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
56  // Live search is heavily dependent on the list module and only available when that module is.
57  $listModule = $backendModuleRepository->findByModuleName('web_list');
58  return $listModule !== null;
59  }
60 
66  public function getItem()
67  {
68  return '
69  <form class="t3js-topbar-navigation-search toolbar-item-search-form live-search-wrapper" role="search">
70  <div class="form-group">
71  <div class="form-control-holder">
72  <div class="form-control-icon">
73  ' . $this->iconFactory->getIcon('apps-toolbar-menu-search', Icon::SIZE_SMALL)->render('inline') . '
74  </div>
75  <input type="text" class="form-control toolbar-item-search-field t3js-topbar-navigation-search-field" placeholder="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.search')) . '" id="live-search-box" autocomplete="off">
76  </div>
77  </div>
78  </form>
79  <a href="#" class="dropdown-toggle t3js-toolbar-search-dropdowntoggle" data-toggle="dropdown" aria-expanded="false"></a>
80  <div class="dropdown-menu" role="menu"></div>
81  ';
82  }
83 
89  public function getAdditionalAttributes()
90  {
91  return ['class' => 'toolbar-item-search t3js-toolbar-item-search'];
92  }
93 
99  public function hasDropDown()
100  {
101  return false;
102  }
103 
109  public function getDropDown()
110  {
111  return '';
112  }
113 
119  public function getIndex()
120  {
121  return 90;
122  }
123 
129  protected function getPageRenderer()
130  {
131  return GeneralUtility::makeInstance(PageRenderer::class);
132  }
133 
139  protected function getLanguageService()
140  {
141  return $GLOBALS['LANG'];
142  }
143 }
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)