[!!!][TASK] Move last language files away from language extension
[Packages/TYPO3.CMS.git] / typo3 / sysext / adminpanel / Classes / View / AdminPanelView.php
1 <?php
2
3 namespace TYPO3\CMS\Adminpanel\View;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use TYPO3\CMS\Adminpanel\Modules\AdminPanelModuleInterface;
19 use TYPO3\CMS\Adminpanel\Service\EditToolbarService;
20 use TYPO3\CMS\Core\Imaging\Icon;
21 use TYPO3\CMS\Core\Imaging\IconFactory;
22 use TYPO3\CMS\Core\Utility\GeneralUtility;
23 use TYPO3\CMS\Core\Utility\PathUtility;
24
25 /**
26 * View class for the admin panel in frontend editing.
27 *
28 * @internal
29 */
30 class AdminPanelView
31 {
32 /**
33 * Determines whether the update button should be shown.
34 *
35 * @var bool
36 */
37 protected $extNeedUpdate = false;
38
39 /**
40 * Force preview
41 *
42 * @var bool
43 */
44 protected $ext_forcePreview = false;
45
46 /**
47 * @var string
48 */
49 protected $extJSCODE = '';
50
51 /**
52 * @var IconFactory
53 */
54 protected $iconFactory;
55
56 /**
57 * Array of adminPanel modules
58 *
59 * @var AdminPanelModuleInterface[]
60 */
61 protected $modules = [];
62
63 /**
64 * @var array
65 */
66 protected $configuration;
67
68 /**
69 * Constructor
70 */
71 public function __construct()
72 {
73 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
74 }
75
76 /**
77 * Setter for injecting new-style modules
78 *
79 * @see \TYPO3\CMS\Adminpanel\Controller\MainController::render()
80 * @param array $modules
81 */
82 public function setModules(array $modules): void
83 {
84 $this->modules = $modules;
85 }
86
87 /**
88 * Returns a link tag with the admin panel stylesheet
89 * defined using TBE_STYLES
90 *
91 * @return string
92 */
93 protected function getAdminPanelStylesheet(): string
94 {
95 $result = '';
96 if (!empty($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) {
97 $stylesheet = GeneralUtility::locationHeaderUrl($GLOBALS['TBE_STYLES']['stylesheets']['admPanel']);
98 $result = '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($stylesheet) . '" />';
99 }
100 return $result;
101 }
102
103 /**
104 * Render a single module with header panel
105 *
106 * @param \TYPO3\CMS\Adminpanel\Modules\AdminPanelModuleInterface $module
107 * @return string
108 */
109 protected function getModule(AdminPanelModuleInterface $module): string
110 {
111 $output = [];
112
113 if ($module->isEnabled()) {
114 $output[] = '<div class="typo3-adminPanel-section typo3-adminPanel-section-' .
115 ($module->isOpen() ? 'open' : 'closed') .
116 '">';
117 $output[] = ' <div class="typo3-adminPanel-section-title">';
118 $output[] = ' ' . $this->getSectionOpenerLink($module);
119 $output[] = ' </div>';
120 if ($module->isOpen()) {
121 $output[] = '<div class="typo3-adminPanel-section-body">';
122 $output[] = ' ' . $module->getContent();
123 $output[] = '</div>';
124 }
125 $output[] = '</div>';
126 }
127
128 foreach ($module->getJavaScriptFiles() as $javaScriptFile) {
129 $output[] =
130 '<script src="' .
131 PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName($javaScriptFile)) .
132 '"></script>';
133 }
134
135 return implode('', $output);
136 }
137
138 /**
139 * Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
140 *
141 * @throws \UnexpectedValueException
142 * @return string HTML for the Admin Panel
143 */
144 public function display()
145 {
146 $this->getLanguageService()->includeLLFile('EXT:core/Resources/Private/Language/locallang_tsfe.xlf');
147
148 $moduleContent = '';
149
150 if ($this->isAdminPanelActivated()) {
151 foreach ($this->modules as $module) {
152 if ($module->isOpen()) {
153 $this->extNeedUpdate = !$this->extNeedUpdate ? $module->showFormSubmitButton() : true;
154 $this->extJSCODE .= $module->getAdditionalJavaScriptCode();
155 }
156 $moduleContent .= $this->getModule($module);
157 }
158
159 foreach (
160 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel']
161 ??
162 [] as $className
163 ) {
164 trigger_error(
165 'The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_adminpanel.php\'][\'extendAdminPanel\'] is deprecated, register an AdminPanelModule instead.',
166 E_USER_DEPRECATED
167 );
168 $hookObject = GeneralUtility::makeInstance($className);
169 if (!$hookObject instanceof AdminPanelViewHookInterface) {
170 throw new \UnexpectedValueException(
171 $className . ' must implement interface ' . AdminPanelViewHookInterface::class,
172 1311942539
173 );
174 }
175 $content = $hookObject->extendAdminPanel($moduleContent, $this);
176 if ($content) {
177 $moduleContent .= '<div class="typo3-adminPanel-section typo3-adminPanel-section-open">';
178 $moduleContent .= ' <div class="typo3-adminPanel-section-body">';
179 $moduleContent .= ' ' . $content;
180 $moduleContent .= ' </div>';
181 $moduleContent .= '</div>';
182 }
183 }
184 }
185
186 $output = [];
187 $output[] = '<!-- TYPO3 Admin panel start -->';
188 $output[] = '<a id="TSFE_ADMIN_PANEL"></a>';
189 $output[] = '<form id="TSFE_ADMIN_PANEL_FORM" name="TSFE_ADMIN_PANEL_FORM" style="display: none;" action="' . htmlspecialchars(GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '#TSFE_ADMIN_PANEL" method="get" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">';
190 if (!GeneralUtility::_GET('id')) {
191 $output[] = '<input type="hidden" name="id" value="' . $this->getTypoScriptFrontendController()->id . '" />';
192 }
193 // The dummy field is needed for Firefox: to force a page reload on submit
194 // which must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
195 $output[] = ' <input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="" />';
196 foreach (GeneralUtility::_GET() as $key => $value) {
197 if ($key !== 'TSFE_ADMIN_PANEL') {
198 if (is_array($value)) {
199 $output[] = $this->getHiddenFields($key, $value);
200 } else {
201 $output[] = '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
202 }
203 }
204 }
205 $output[] = ' <input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="0" />';
206 $output[] = ' <input id="typo3AdminPanelEnable" type="checkbox" onchange="document.TSFE_ADMIN_PANEL_FORM.submit();" name="TSFE_ADMIN_PANEL[display_top]" value="1"' .
207 ($this->isAdminPanelActivated() ? ' checked="checked"' : '') .
208 '/>';
209 $output[] = ' <input id="typo3AdminPanelCollapse" type="checkbox" value="1" />';
210 $output[] = ' <div class="typo3-adminPanel typo3-adminPanel-state-' .
211 ($this->isAdminPanelActivated() ? 'open' : 'closed') .
212 '">';
213 $output[] = ' <div class="typo3-adminPanel-header">';
214 $output[] = ' <span class="typo3-adminPanel-header-title">' . $this->extGetLL('adminPanelTitle') . '</span>';
215 $output[] = ' <span class="typo3-adminPanel-header-user">' . htmlspecialchars($this->getBackendUser()->user['username']) . '</span>';
216 $output[] = ' <label for="typo3AdminPanelEnable" class="typo3-adminPanel-header-enable">';
217 $output[] = ' <span class="typo3-adminPanel-header-enable-enabled">';
218 $output[] = ' ' . $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render('inline');
219 $output[] = ' </span>';
220 $output[] = ' <span class="typo3-adminPanel-header-enable-disabled">';
221 $output[] = ' ' . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL)->render('inline');
222 $output[] = ' </span>';
223 $output[] = ' </label>';
224 $output[] = ' <label for="typo3AdminPanelCollapse" class="typo3-adminPanel-header-collapse">';
225 $output[] = ' <span class="typo3-adminPanel-header-collapse-enabled">';
226 $output[] = ' ' . $this->iconFactory->getIcon('actions-view-list-collapse', Icon::SIZE_SMALL)->render('inline');
227 $output[] = ' </span>';
228 $output[] = ' <span class="typo3-adminPanel-header-collapse-disabled">';
229 $output[] = ' ' . $this->iconFactory->getIcon('actions-view-list-expand', Icon::SIZE_SMALL)->render('inline');
230 $output[] = ' </span>';
231 $output[] = ' </label>';
232 $output[] = ' </div>';
233 if ($moduleContent && $this->extNeedUpdate) {
234 $output[] = '<div class="typo3-adminPanel-actions">';
235 $output[] = ' <input class="typo3-adminPanel-btn typo3-adminPanel-btn-dark" type="submit" value="' . $this->extGetLL('update') . '" />';
236 $output[] = '</div>';
237 }
238 $output[] = ' <div class="typo3-adminPanel-body">';
239 $output[] = ' ' . $moduleContent;
240 $output[] = ' </div>';
241 $output[] = ' </div>';
242 $output[] = '</form>';
243 if ($this->getBackendUser()->uc['TSFE_adminConfig']['display_top']) {
244 $evalFieldJavaScriptFile = GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/JavaScript/jsfunc.evalfield.js');
245 $output[] = '<script type="text/javascript" src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($evalFieldJavaScriptFile)) . '"></script>';
246 $output[] = '<script type="text/javascript">/*<![CDATA[*/' . GeneralUtility::minifyJavaScript('
247 var evalFunc = new evalFunc();
248 // TSFEtypo3FormFieldSet()
249 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) { //
250 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
251 var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
252 if (checkbox && theValue==checkboxValue) {
253 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
254 alert(theField);
255 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
256 } else {
257 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
258 if (document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"]) {
259 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
260 }
261 }
262 }
263 // TSFEtypo3FormFieldGet()
264 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) { //
265 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
266 if (checkbox_off) {
267 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
268 }else{
269 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
270 }
271 TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
272 }') . '/*]]>*/</script>';
273 $output[] = '<script language="javascript" type="text/javascript">' . $this->extJSCODE . '</script>';
274 }
275 $cssFileLocation = GeneralUtility::getFileAbsFileName('EXT:adminpanel/Resources/Public/Css/adminpanel.css');
276 $output[] = '<link type="text/css" rel="stylesheet" href="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($cssFileLocation)) . '" media="all" />';
277 $output[] = $this->getAdminPanelStylesheet();
278 $output[] = '<!-- TYPO3 admin panel end -->';
279
280 return implode('', $output);
281 }
282
283 /**
284 * Fetches recursively all GET parameters as hidden fields.
285 * Called from display()
286 *
287 * @param string $key Current key
288 * @param array $val Current value
289 * @return string Hidden fields HTML-code
290 * @see display()
291 */
292 protected function getHiddenFields($key, array $val)
293 {
294 $out = '';
295 foreach ($val as $k => $v) {
296 if (is_array($v)) {
297 $out .= $this->getHiddenFields($key . '[' . $k . ']', $v);
298 } else {
299 $out .= '<input type="hidden" name="' . htmlspecialchars($key) . '[' . htmlspecialchars($k) . ']" value="' . htmlspecialchars($v) . '">' . LF;
300 }
301 }
302 return $out;
303 }
304
305 /**
306 * Returns true if admin panel was activated
307 * (switched "on" via GUI)
308 *
309 * @return bool
310 */
311 protected function isAdminPanelActivated(): bool
312 {
313 return $this->getBackendUser()->uc['TSFE_adminConfig']['display_top'] ?? false;
314 }
315
316 /*****************************************************
317 * Admin Panel Layout Helper functions
318 ****************************************************/
319
320 /**
321 * Wraps a string in a link which will open/close a certain part of the Admin Panel
322 *
323 * @param AdminPanelModuleInterface $module
324 * @return string
325 */
326 protected function getSectionOpenerLink(AdminPanelModuleInterface $module): string
327 {
328 $identifier = $module->getIdentifier();
329 $onclick = 'document.TSFE_ADMIN_PANEL_FORM[' .
330 GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[display_' . $identifier . ']') .
331 '].value=' .
332 ($this->getBackendUser()->uc['TSFE_adminConfig']['display_' . $identifier] ? '0' : '1') .
333 ';document.TSFE_ADMIN_PANEL_FORM.submit();return false;';
334
335 $output = [];
336 $output[] = '<span class="typo3-adminPanel-section-title-identifier"></span>';
337 $output[] = '<a href="javascript:void(0)" onclick="' . htmlspecialchars($onclick) . '">';
338 $output[] = ' ' . htmlspecialchars($module->getLabel());
339 $output[] = '</a>';
340 $output[] = '<input type="hidden" name="TSFE_ADMIN_PANEL[display_' .
341 $identifier .
342 ']" value="' .
343 (int)$module->isOpen() .
344 '" />';
345
346 return implode('', $output);
347 }
348
349 /**
350 * Creates the tool bar links for the "edit" section of the Admin Panel.
351 *
352 * @deprecated
353 * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
354 */
355 public function ext_makeToolBar()
356 {
357 trigger_error('', E_USER_DEPRECATED);
358 $editToolbarService = GeneralUtility::makeInstance(EditToolbarService::class);
359 return $editToolbarService->createToolbar();
360 }
361
362 /**
363 * Translate given key
364 *
365 * @param string $key Key for a label in the $LOCAL_LANG array of "sysext/core/Resources/Private/Language/locallang_tsfe.xlf
366 * @param bool $convertWithHtmlspecialchars If TRUE the language-label will be sent through htmlspecialchars
367 * @return string The value for the $key
368 */
369 protected function extGetLL($key, $convertWithHtmlspecialchars = true)
370 {
371 $labelStr = $this->getLanguageService()->getLL($key);
372 if ($convertWithHtmlspecialchars) {
373 $labelStr = htmlspecialchars($labelStr);
374 }
375 return $labelStr;
376 }
377
378 /**
379 * Returns LanguageService
380 *
381 * @return \TYPO3\CMS\Core\Localization\LanguageService
382 */
383 protected function getLanguageService()
384 {
385 return $GLOBALS['LANG'];
386 }
387
388 /**
389 * Returns the current BE user.
390 *
391 * @return \TYPO3\CMS\Backend\FrontendBackendUserAuthentication
392 */
393 protected function getBackendUser()
394 {
395 return $GLOBALS['BE_USER'];
396 }
397
398 /**
399 * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
400 */
401 protected function getTypoScriptFrontendController()
402 {
403 return $GLOBALS['TSFE'];
404 }
405
406 /*****************************************************
407 * Admin Panel: Deprecated API
408 ****************************************************/
409
410 /**
411 * Add an additional stylesheet
412 *
413 * @return string
414 * @deprecated since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)
415 */
416 public function getAdminPanelHeaderData()
417 {
418 trigger_error(
419 'Deprecated since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)',
420 E_USER_DEPRECATED
421 );
422 return $this->getAdminPanelStylesheet();
423 }
424
425 /**
426 * Checks if an Admin Panel section ("module") is available for the user. If so, TRUE is returned.
427 *
428 * @param string $key The module key, eg. "edit", "preview", "info" etc.
429 * @deprecated but still called in FrontendBackendUserAuthentication (will be refactored in a separate step)
430 * @return bool
431 */
432 public function isAdminModuleEnabled($key)
433 {
434 $result = false;
435 // Returns TRUE if the module checked is "preview" and the forcePreview flag is set.
436 if ($key === 'preview' && $this->ext_forcePreview) {
437 $result = true;
438 } elseif (!empty($this->configuration['enable.']['all'])) {
439 $result = true;
440 } elseif (!empty($this->configuration['enable.'][$key])) {
441 $result = true;
442 }
443 return $result;
444 }
445
446 /**
447 * Saves any change in settings made in the Admin Panel.
448 *
449 * @deprecated since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)
450 */
451 public function saveConfigOptions()
452 {
453 trigger_error(
454 'Deprecated since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)',
455 E_USER_DEPRECATED
456 );
457 $this->saveConfiguration();
458 }
459
460 /**
461 * Returns the value for an Admin Panel setting.
462 *
463 * @param string $sectionName Module key
464 * @param string $val Setting key
465 * @return mixed The setting value
466 * @deprecated Since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)
467 */
468 public function extGetFeAdminValue($sectionName, $val = '')
469 {
470 trigger_error(
471 'Deprecated since TYPO3 v9 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface)',
472 E_USER_DEPRECATED
473 );
474 if (!$this->isAdminModuleEnabled($sectionName)) {
475 return null;
476 }
477
478 $beUser = $this->getBackendUser();
479 // Exceptions where the values can be overridden (forced) from backend:
480 // deprecated
481 if (
482 $sectionName === 'edit' && (
483 $val === 'displayIcons' && $this->configuration['module.']['edit.']['forceDisplayIcons'] ||
484 $val === 'displayFieldIcons' && $this->configuration['module.']['edit.']['forceDisplayFieldIcons'] ||
485 $val === 'editNoPopup' && $this->configuration['module.']['edit.']['forceNoPopup']
486 )
487 ) {
488 return true;
489 }
490
491 // Override all settings with user TSconfig
492 if ($val && isset($this->configuration['override.'][$sectionName . '.'][$val])) {
493 return $this->configuration['override.'][$sectionName . '.'][$val];
494 }
495 if (!$val && isset($this->configuration['override.'][$sectionName])) {
496 return $this->configuration['override.'][$sectionName];
497 }
498
499 $returnValue = $val ? $beUser->uc['TSFE_adminConfig'][$sectionName . '_' . $val] : 1;
500
501 // Exception for preview
502 if ($sectionName === 'preview' && $this->ext_forcePreview) {
503 return !$val ? true : $returnValue;
504 }
505
506 // See if the menu is expanded!
507 return $this->isAdminModuleOpen($sectionName) ? $returnValue : null;
508 }
509
510 /**
511 * Enables the force preview option.
512 *
513 * @deprecated since TYPO3 v9 - see AdminPanelModule: Preview
514 */
515 public function forcePreview()
516 {
517 trigger_error('Deprecated since TYPO3 v9, see AdminPanelModule: Preview', E_USER_DEPRECATED);
518 $this->ext_forcePreview = true;
519 }
520
521 /**
522 * Returns TRUE if admin panel module is open
523 *
524 * @param string $key Module key
525 * @return bool TRUE, if the admin panel is open for the specified admin panel module key.
526 * @deprecated Since TYPO3 v9 - implement AdminPanelModules via the new API
527 */
528 public function isAdminModuleOpen($key)
529 {
530 trigger_error('since TYPO3 v9 - use new AdminPanel API instead', E_USER_DEPRECATED);
531 return $this->getBackendUser()->uc['TSFE_adminConfig']['display_top'] &&
532 $this->getBackendUser()->uc['TSFE_adminConfig']['display_' . $key];
533 }
534
535 /**
536 * Returns a row (with 4 columns) for content in a section of the Admin Panel.
537 * It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
538 *
539 * @param string $title Key to label
540 * @param string $content The HTML content for the forth table cell.
541 * @param string $checkbox The HTML for a checkbox or hidden fields.
542 * @param string $innerDivClass The Class attribute for the td element.
543 * @param string $outerDivClass The Class attribute for the tr element.
544 * @return string HTML table row.
545 * @see extGetHead()
546 * @deprecated since TYPO3 v9 - use new AdminPanel API instead
547 */
548 public function extGetItem($title, $content = '', $checkbox = '', $outerDivClass = null, $innerDivClass = null)
549 {
550 trigger_error('since TYPO3 v9 - use new AdminPanel API instead', E_USER_DEPRECATED);
551 $title = $title ? '<label for="' . htmlspecialchars($title) . '">' . $this->extGetLL($title) . '</label>' : '';
552 $out = '';
553 $out .= (string)$outerDivClass ? '<div class="' . htmlspecialchars($outerDivClass) . '">' : '<div>';
554 $out .= (string)$innerDivClass ? '<div class="' . htmlspecialchars($innerDivClass) . '">' : '<div>';
555 $out .= $checkbox . $title . $content . '</div></div>';
556 return $out;
557 }
558
559 /**
560 * Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
561 * It will have a plus/minus icon and a label which is linked so that it submits the form which surrounds the whole Admin Panel when clicked, alterting the TSFE_ADMIN_PANEL[display_' . $pre . '] value
562 * See the functions get*Module
563 *
564 * @param string $sectionSuffix The suffix to the display_ label. Also selects the label from the LOCAL_LANG array.
565 * @return string HTML table row.
566 * @see extGetItem()
567 * @deprecated since TYPO3 v9 - use new AdminPanel API instead
568 */
569 public function extGetHead($sectionSuffix)
570 {
571 trigger_error('since TYPO3 v9 - use new AdminPanel API instead', E_USER_DEPRECATED);
572 return $this->linkSectionHeader($sectionSuffix, $this->extGetLL($sectionSuffix));
573 }
574
575 /**
576 * Wraps a string in a link which will open/close a certain part of the Admin Panel
577 *
578 * @param string $sectionSuffix The code for the display_ label/key
579 * @param string $sectionTitle Title (HTML-escaped)
580 * @param string $className The classname for the <a> tag
581 * @return string $className Linked input string
582 * @see extGetHead()
583 * @deprecated since TYPO3 v9 - use new AdminPanel API instead
584 */
585 public function linkSectionHeader($sectionSuffix, $sectionTitle, $className = '')
586 {
587 trigger_error('since TYPO3 v9 - use new AdminPanel API instead', E_USER_DEPRECATED);
588 $onclick = 'document.TSFE_ADMIN_PANEL_FORM[' .
589 GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[display_' . $sectionSuffix . ']') .
590 '].value=' .
591 ($this->getBackendUser()->uc['TSFE_adminConfig']['display_' . $sectionSuffix] ? '0' : '1') .
592 ';document.TSFE_ADMIN_PANEL_FORM.submit();return false;';
593
594 $output = [];
595 $output[] = '<span class="typo3-adminPanel-section-title-identifier"></span>';
596 $output[] = '<a href="javascript:void(0)" onclick="' . htmlspecialchars($onclick) . '">';
597 $output[] = ' ' . $sectionTitle;
598 $output[] = '</a>';
599 $output[] = '<input type="hidden" name="TSFE_ADMIN_PANEL[display_' .
600 $sectionSuffix .
601 ']" value="' .
602 (int)$this->isAdminModuleOpen($sectionSuffix) .
603 '" />';
604
605 return implode('', $output);
606 }
607 }