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\ModuleApi\ConfigurableInterface; |
19
|
|
|
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface; |
20
|
|
|
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleInterface; |
21
|
|
|
use TYPO3\CMS\Adminpanel\Service\EditToolbarService; |
22
|
|
|
use TYPO3\CMS\Adminpanel\Utility\StateUtility; |
23
|
|
|
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication; |
24
|
|
|
use TYPO3\CMS\Core\Cache\CacheManager; |
25
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
26
|
|
|
use TYPO3\CMS\Core\Utility\PathUtility; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* View class for the admin panel in frontend editing. |
30
|
|
|
* |
31
|
|
|
* @internal |
32
|
|
|
*/ |
33
|
|
|
class AdminPanelView |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* Force preview |
37
|
|
|
* |
38
|
|
|
* @var bool |
39
|
|
|
*/ |
40
|
|
|
protected $ext_forcePreview = false; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Array of adminPanel modules |
44
|
|
|
* |
45
|
|
|
* @var \TYPO3\CMS\Adminpanel\ModuleApi\ModuleInterface[] |
46
|
|
|
*/ |
47
|
|
|
protected $modules = []; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var array |
51
|
|
|
*/ |
52
|
|
|
protected $configuration; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Setter for injecting new-style modules |
56
|
|
|
* |
57
|
|
|
* @see \TYPO3\CMS\Adminpanel\Controller\MainController::render() |
58
|
|
|
* @param array $modules |
59
|
|
|
* @internal |
60
|
|
|
*/ |
61
|
|
|
public function setModules(array $modules): void |
62
|
|
|
{ |
63
|
|
|
$this->modules = $modules; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Returns LanguageService |
68
|
|
|
* |
69
|
|
|
* @return \TYPO3\CMS\Core\Localization\LanguageService |
70
|
|
|
*/ |
71
|
|
|
protected function getLanguageService() |
72
|
|
|
{ |
73
|
|
|
return $GLOBALS['LANG']; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Returns the current BE user. |
78
|
|
|
* |
79
|
|
|
* @return FrontendBackendUserAuthentication |
80
|
|
|
*/ |
81
|
|
|
protected function getBackendUser() |
82
|
|
|
{ |
83
|
|
|
return $GLOBALS['BE_USER']; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/***************************************************** |
87
|
|
|
* Admin Panel: Deprecated API |
88
|
|
|
****************************************************/ |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Backwards compatibility method ensuring hook still gets the same content as before |
92
|
|
|
* |
93
|
|
|
* @deprecated since TYPO3 v9 - remove when hook can be removed |
94
|
|
|
* @internal |
95
|
|
|
* @return string |
96
|
|
|
* @throws \UnexpectedValueException |
97
|
|
|
*/ |
98
|
|
|
public function callDeprecatedHookObject(): string |
99
|
|
|
{ |
100
|
|
|
$moduleContent = ''; |
101
|
|
|
if (StateUtility::isOpen()) { |
102
|
|
|
foreach ($this->modules as $module) { |
103
|
|
|
$moduleContent .= $this->getModule($module); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
foreach ( |
107
|
|
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'] |
108
|
|
|
?? |
109
|
|
|
[] as $className |
110
|
|
|
) { |
111
|
|
|
trigger_error( |
112
|
|
|
'The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_adminpanel.php\'][\'extendAdminPanel\'] is deprecated, register an AdminPanelModule instead.', |
113
|
|
|
E_USER_DEPRECATED |
114
|
|
|
); |
115
|
|
|
$hookObject = GeneralUtility::makeInstance($className); |
116
|
|
|
if (!$hookObject instanceof AdminPanelViewHookInterface) { |
117
|
|
|
throw new \UnexpectedValueException( |
118
|
|
|
$className . ' must implement interface ' . AdminPanelViewHookInterface::class, |
119
|
|
|
1311942539 |
120
|
|
|
); |
121
|
|
|
} |
122
|
|
|
$content = $hookObject->extendAdminPanel($moduleContent, $this); |
123
|
|
|
if ($content) { |
124
|
|
|
$moduleContent .= '<div class="typo3-adminPanel-section typo3-adminPanel-section-open">'; |
125
|
|
|
$moduleContent .= ' <div class="typo3-adminPanel-section-body">'; |
126
|
|
|
$moduleContent .= ' ' . $content; |
127
|
|
|
$moduleContent .= ' </div>'; |
128
|
|
|
$moduleContent .= '</div>'; |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
return $moduleContent; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Render a single module with header panel |
137
|
|
|
* |
138
|
|
|
* @deprecated Since TYPO3 v9 - only used in deprecated hook call (which triggers the corresponding deprecation error) |
139
|
|
|
* @param ModuleInterface $module |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
protected function getModule(ModuleInterface $module): string |
143
|
|
|
{ |
144
|
|
|
$output = []; |
145
|
|
|
|
146
|
|
|
if ($module instanceof ConfigurableInterface && $module->isEnabled()) { |
147
|
|
|
$output[] = '<div class="typo3-adminPanel-section typo3-adminPanel-section-open">'; |
148
|
|
|
$output[] = ' <div class="typo3-adminPanel-section-title">'; |
149
|
|
|
$output[] = ' ' . $this->getSectionOpenerLink($module); |
150
|
|
|
$output[] = ' </div>'; |
151
|
|
|
$output[] = '<div class="typo3-adminPanel-section-body">'; |
152
|
|
|
$output[] = ' ' . $module->getContent(); |
|
|
|
|
153
|
|
|
$output[] = '</div>'; |
154
|
|
|
$output[] = '</div>'; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
if ($module instanceof DataProviderInterface) { |
158
|
|
|
foreach ($module->getJavaScriptFiles() as $javaScriptFile) { |
|
|
|
|
159
|
|
|
$output[] = |
160
|
|
|
'<script src="' . |
161
|
|
|
PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName($javaScriptFile)) . |
162
|
|
|
'"></script>'; |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
return implode('', $output); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/***************************************************** |
170
|
|
|
* Admin Panel Layout Helper functions |
171
|
|
|
****************************************************/ |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Wraps a string in a link which will open/close a certain part of the Admin Panel |
175
|
|
|
* |
176
|
|
|
* @deprecated Since TYPO3 v9 - only used in deprecated hook call (which triggers the corresponding deprecation error) |
177
|
|
|
* @param ModuleInterface $module |
178
|
|
|
* @return string |
179
|
|
|
*/ |
180
|
|
|
protected function getSectionOpenerLink(ModuleInterface $module): string |
181
|
|
|
{ |
182
|
|
|
$identifier = $module->getIdentifier(); |
183
|
|
|
$onclick = 'document.TSFE_ADMIN_PANEL_FORM[' . |
184
|
|
|
GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[display_' . $identifier . ']') . |
185
|
|
|
'].value=' . |
186
|
|
|
($this->getBackendUser()->uc['AdminPanel']['display_' . $identifier] ? '0' : '1') . |
187
|
|
|
';document.TSFE_ADMIN_PANEL_FORM.submit();return false;'; |
188
|
|
|
|
189
|
|
|
$output = []; |
190
|
|
|
$output[] = '<span class="typo3-adminPanel-section-title-identifier"></span>'; |
191
|
|
|
$output[] = '<a href="javascript:void(0)" onclick="' . htmlspecialchars($onclick) . '">'; |
192
|
|
|
$output[] = ' ' . htmlspecialchars($module->getLabel()); |
193
|
|
|
$output[] = '</a>'; |
194
|
|
|
$output[] = '<input type="hidden" name="TSFE_ADMIN_PANEL[display_' . |
195
|
|
|
$identifier . |
196
|
|
|
']" value="' . |
197
|
|
|
1 . |
198
|
|
|
'" />'; |
199
|
|
|
|
200
|
|
|
return implode('', $output); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Creates the tool bar links for the "edit" section of the Admin Panel. |
205
|
|
|
* |
206
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10. Use EditToolbarService instead or create buttons via fluid |
207
|
|
|
* @return string A string containing images wrapped in <a>-tags linking them to proper functions. |
208
|
|
|
*/ |
209
|
|
|
public function ext_makeToolBar(): string |
210
|
|
|
{ |
211
|
|
|
trigger_error( |
212
|
|
|
'Deprecated since TYPO3 v9, use fluid and backend uri builder to create a toolbar', |
213
|
|
|
E_USER_DEPRECATED |
214
|
|
|
); |
215
|
|
|
$editToolbarService = GeneralUtility::makeInstance(EditToolbarService::class); |
216
|
|
|
return $editToolbarService->createToolbar(); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Translate given key |
221
|
|
|
* |
222
|
|
|
* @param string $key Key for a label in the $LOCAL_LANG array of "EXT:core/Resources/Private/Language/locallang_tsfe.xlf |
223
|
|
|
* @param bool $convertWithHtmlspecialchars If TRUE the language-label will be sent through htmlspecialchars |
224
|
|
|
* @deprecated Since TYPO3 v9, will be removed in TYPO3 v10.0 - only used in deprecated methods |
225
|
|
|
* @return string The value for the $key |
226
|
|
|
*/ |
227
|
|
|
protected function extGetLL($key, $convertWithHtmlspecialchars = true) |
228
|
|
|
{ |
229
|
|
|
$labelStr = $this->getLanguageService()->getLL($key); |
230
|
|
|
if ($convertWithHtmlspecialchars) { |
231
|
|
|
$labelStr = htmlspecialchars($labelStr); |
232
|
|
|
} |
233
|
|
|
return $labelStr; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Add an additional stylesheet |
238
|
|
|
* |
239
|
|
|
* @return string |
240
|
|
|
* @deprecated Since TYPO3 v9, will be removed in TYPO3 v10.0 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface) |
241
|
|
|
*/ |
242
|
|
|
public function getAdminPanelHeaderData() |
243
|
|
|
{ |
244
|
|
|
trigger_error( |
245
|
|
|
'AdminPanelView->' . |
246
|
|
|
__METHOD__ . |
247
|
|
|
' will be removed in TYPO3 v10.0. Implement AdminPanelModules via the new API (see AdminPanelModuleInterface).', |
248
|
|
|
E_USER_DEPRECATED |
249
|
|
|
); |
250
|
|
|
$result = ''; |
251
|
|
|
if (!empty($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) { |
252
|
|
|
$stylesheet = GeneralUtility::locationHeaderUrl($GLOBALS['TBE_STYLES']['stylesheets']['admPanel']); |
253
|
|
|
$result = '<link rel="stylesheet" type="text/css" href="' . |
254
|
|
|
htmlspecialchars($stylesheet, ENT_QUOTES | ENT_HTML5) . '" />'; |
255
|
|
|
} |
256
|
|
|
return $result; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Checks if an Admin Panel section ("module") is available for the user. If so, TRUE is returned. |
261
|
|
|
* |
262
|
|
|
* @param string $key The module key, eg. "edit", "preview", "info" etc. |
263
|
|
|
* @return bool |
264
|
|
|
* @deprecated Since TYPO3 v9, will be removed in TYPO3 v10.0 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface) |
265
|
|
|
*/ |
266
|
|
|
public function isAdminModuleEnabled($key) |
267
|
|
|
{ |
268
|
|
|
trigger_error( |
269
|
|
|
'AdminPanelView->' . |
270
|
|
|
__METHOD__ . |
271
|
|
|
' will be removed in TYPO3 v10.0. Implement AdminPanelModules via the new API (see AdminPanelModuleInterface).', |
272
|
|
|
E_USER_DEPRECATED |
273
|
|
|
); |
274
|
|
|
$result = false; |
275
|
|
|
// Returns TRUE if the module checked is "preview" and the forcePreview flag is set. |
276
|
|
|
if ($key === 'preview' && $this->ext_forcePreview) { |
277
|
|
|
$result = true; |
278
|
|
|
} elseif (!empty($this->configuration['enable.']['all'])) { |
279
|
|
|
$result = true; |
280
|
|
|
} elseif (!empty($this->configuration['enable.'][$key])) { |
281
|
|
|
$result = true; |
282
|
|
|
} |
283
|
|
|
return $result; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Saves any change in settings made in the Admin Panel. |
288
|
|
|
* |
289
|
|
|
* @deprecated Since TYPO3 v9, will be removed in TYPO3 v10.0 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface) |
290
|
|
|
*/ |
291
|
|
|
public function saveConfigOptions() |
292
|
|
|
{ |
293
|
|
|
trigger_error( |
294
|
|
|
'AdminPanelView->' . |
295
|
|
|
__METHOD__ . |
296
|
|
|
' will be removed in TYPO3 v10.0. Implement AdminPanelModules via the new API (see AdminPanelModuleInterface).', |
297
|
|
|
E_USER_DEPRECATED |
298
|
|
|
); |
299
|
|
|
$input = GeneralUtility::_GP('TSFE_ADMIN_PANEL'); |
300
|
|
|
$beUser = $this->getBackendUser(); |
301
|
|
|
if (is_array($input)) { |
302
|
|
|
// Setting |
303
|
|
|
$beUser->uc['AdminPanel'] = array_merge( |
304
|
|
|
!is_array($beUser->uc['AdminPanel']) ? [] : $beUser->uc['AdminPanel'], |
305
|
|
|
$input |
306
|
|
|
); |
307
|
|
|
unset($beUser->uc['AdminPanel']['action']); |
308
|
|
|
|
309
|
|
|
foreach ($this->modules as $module) { |
310
|
|
|
if ($module->isEnabled()) { |
|
|
|
|
311
|
|
|
// We use TYPO3_REQUEST for compatibility reasons. The object and this method are deprecated anyway, this should be fine. |
312
|
|
|
$module->onSubmit($input, $GLOBALS['TYPO3_REQUEST']); |
|
|
|
|
313
|
|
|
} |
314
|
|
|
} |
315
|
|
|
// Saving |
316
|
|
|
$beUser->writeUC(); |
317
|
|
|
// Flush fluid template cache |
318
|
|
|
$cacheManager = new CacheManager(); |
319
|
|
|
$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); |
320
|
|
|
$cacheManager->getCache('fluid_template')->flush(); |
321
|
|
|
} |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Returns the value for an Admin Panel setting. |
326
|
|
|
* |
327
|
|
|
* @param string $sectionName Module key |
328
|
|
|
* @param string $val Setting key |
329
|
|
|
* @return mixed The setting value |
330
|
|
|
* @deprecated Since TYPO3 v9, will be removed in TYPO3 v10.0 - implement AdminPanelModules via the new API (see AdminPanelModuleInterface) |
331
|
|
|
*/ |
332
|
|
|
public function extGetFeAdminValue($sectionName, $val = '') |
333
|
|
|
{ |
334
|
|
|
trigger_error( |
335
|
|
|
'AdminPanelView->' . |
336
|
|
|
__METHOD__ . |
337
|
|
|
' will be removed in TYPO3 v10.0. Implement AdminPanelModules via the new API (see AdminPanelModuleInterface).', |
338
|
|
|
E_USER_DEPRECATED |
339
|
|
|
); |
340
|
|
|
trigger_error( |
341
|
|
|
'Deprecated since TYPO3 v9 - ', |
342
|
|
|
E_USER_DEPRECATED |
343
|
|
|
); |
344
|
|
|
if (!$this->isAdminModuleEnabled($sectionName)) { |
345
|
|
|
return null; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
$beUser = $this->getBackendUser(); |
349
|
|
|
// Exceptions where the values can be overridden (forced) from backend: |
350
|
|
|
// deprecated |
351
|
|
|
if ( |
352
|
|
|
$sectionName === 'edit' && ( |
353
|
|
|
$val === 'displayIcons' && $this->configuration['module.']['edit.']['forceDisplayIcons'] || |
354
|
|
|
$val === 'displayFieldIcons' && $this->configuration['module.']['edit.']['forceDisplayFieldIcons'] || |
355
|
|
|
$val === 'editNoPopup' && $this->configuration['module.']['edit.']['forceNoPopup'] |
356
|
|
|
) |
357
|
|
|
) { |
358
|
|
|
return true; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
// Override all settings with user TSconfig |
362
|
|
|
if ($val && isset($this->configuration['override.'][$sectionName . '.'][$val])) { |
363
|
|
|
return $this->configuration['override.'][$sectionName . '.'][$val]; |
364
|
|
|
} |
365
|
|
|
if (!$val && isset($this->configuration['override.'][$sectionName])) { |
366
|
|
|
return $this->configuration['override.'][$sectionName]; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
$returnValue = $val ? $beUser->uc['AdminPanel'][$sectionName . '_' . $val] : 1; |
370
|
|
|
|
371
|
|
|
// Exception for preview |
372
|
|
|
if ($sectionName === 'preview' && $this->ext_forcePreview) { |
373
|
|
|
return !$val ? true : $returnValue; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
// See if the menu is expanded! |
377
|
|
|
return $this->isAdminModuleOpen($sectionName) ? $returnValue : null; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Enables the force preview option. |
382
|
|
|
* |
383
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - see AdminPanelModule: Preview |
384
|
|
|
*/ |
385
|
|
|
public function forcePreview() |
386
|
|
|
{ |
387
|
|
|
trigger_error( |
388
|
|
|
'AdminPanelView->' . |
389
|
|
|
__METHOD__ . |
390
|
|
|
' will be removed in TYPO3 v10.0. Use new AdminPanel Preview Module instead.', |
391
|
|
|
E_USER_DEPRECATED |
392
|
|
|
); |
393
|
|
|
$this->ext_forcePreview = true; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* Returns TRUE if admin panel module is open |
398
|
|
|
* |
399
|
|
|
* @param string $key Module key |
400
|
|
|
* @return bool TRUE, if the admin panel is open for the specified admin panel module key. |
401
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - use new AdminPanel API instead |
402
|
|
|
*/ |
403
|
|
|
public function isAdminModuleOpen($key) |
404
|
|
|
{ |
405
|
|
|
trigger_error( |
406
|
|
|
'AdminPanelView->' . __METHOD__ . ' will be removed in TYPO3 v10.0. Use new AdminPanel API instead.', |
407
|
|
|
E_USER_DEPRECATED |
408
|
|
|
); |
409
|
|
|
return $this->getBackendUser()->uc['AdminPanel']['display_top'] && |
410
|
|
|
$this->getBackendUser()->uc['AdminPanel']['display_' . $key]; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Returns a row (with 4 columns) for content in a section of the Admin Panel. |
415
|
|
|
* It will take $pre as a key to a label to display and $element as the content to put into the forth cell. |
416
|
|
|
* |
417
|
|
|
* @param string $title Key to label |
418
|
|
|
* @param string $content The HTML content for the forth table cell. |
419
|
|
|
* @param string $checkbox The HTML for a checkbox or hidden fields. |
420
|
|
|
* @param string $innerDivClass The Class attribute for the td element. |
421
|
|
|
* @param string $outerDivClass The Class attribute for the tr element. |
422
|
|
|
* @return string HTML table row. |
423
|
|
|
* @see extGetHead() |
424
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - use new AdminPanel API instead |
425
|
|
|
*/ |
426
|
|
|
public function extGetItem($title, $content = '', $checkbox = '', $outerDivClass = null, $innerDivClass = null) |
427
|
|
|
{ |
428
|
|
|
trigger_error( |
429
|
|
|
'AdminPanelView->' . __METHOD__ . ' will be removed in TYPO3 v10.0. Use new AdminPanel API instead.', |
430
|
|
|
E_USER_DEPRECATED |
431
|
|
|
); |
432
|
|
|
$title = $title ? '<label for="' . htmlspecialchars($title) . '">' . $this->extGetLL($title) . '</label>' : ''; |
433
|
|
|
$out = ''; |
434
|
|
|
$out .= (string)$outerDivClass ? '<div class="' . htmlspecialchars($outerDivClass) . '">' : '<div>'; |
435
|
|
|
$out .= (string)$innerDivClass ? '<div class="' . htmlspecialchars($innerDivClass) . '">' : '<div>'; |
436
|
|
|
$out .= $checkbox . $title . $content . '</div></div>'; |
437
|
|
|
return $out; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Returns a row (with colspan=4) which is a header for a section in the Admin Panel. |
442
|
|
|
* 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 |
443
|
|
|
* See the functions get*Module |
444
|
|
|
* |
445
|
|
|
* @param string $sectionSuffix The suffix to the display_ label. Also selects the label from the LOCAL_LANG array. |
446
|
|
|
* @return string HTML table row. |
447
|
|
|
* @see extGetItem() |
448
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - use new AdminPanel API instead |
449
|
|
|
*/ |
450
|
|
|
public function extGetHead($sectionSuffix) |
451
|
|
|
{ |
452
|
|
|
trigger_error( |
453
|
|
|
'AdminPanelView->' . __METHOD__ . ' will be removed in TYPO3 v10.0. Use new AdminPanel API instead.', |
454
|
|
|
E_USER_DEPRECATED |
455
|
|
|
); |
456
|
|
|
return $this->linkSectionHeader($sectionSuffix, $this->extGetLL($sectionSuffix)); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* Wraps a string in a link which will open/close a certain part of the Admin Panel |
461
|
|
|
* |
462
|
|
|
* @param string $sectionSuffix The code for the display_ label/key |
463
|
|
|
* @param string $sectionTitle Title (HTML-escaped) |
464
|
|
|
* @param string $className The classname for the <a> tag |
465
|
|
|
* @return string $className Linked input string |
466
|
|
|
* @see extGetHead() |
467
|
|
|
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - use new AdminPanel API instead |
468
|
|
|
*/ |
469
|
|
|
public function linkSectionHeader($sectionSuffix, $sectionTitle, $className = '') |
|
|
|
|
470
|
|
|
{ |
471
|
|
|
trigger_error( |
472
|
|
|
'AdminPanelView->' . __METHOD__ . ' will be removed in TYPO3 v10.0. Use new AdminPanel API instead.', |
473
|
|
|
E_USER_DEPRECATED |
474
|
|
|
); |
475
|
|
|
$onclick = 'document.TSFE_ADMIN_PANEL_FORM[' . |
476
|
|
|
GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[display_' . $sectionSuffix . ']') . |
477
|
|
|
'].value=' . |
478
|
|
|
($this->getBackendUser()->uc['AdminPanel']['display_' . $sectionSuffix] ? '0' : '1') . |
479
|
|
|
';document.TSFE_ADMIN_PANEL_FORM.submit();return false;'; |
480
|
|
|
|
481
|
|
|
$output = []; |
482
|
|
|
$output[] = '<span class="typo3-adminPanel-section-title-identifier"></span>'; |
483
|
|
|
$output[] = '<a href="javascript:void(0)" onclick="' . htmlspecialchars($onclick) . '">'; |
484
|
|
|
$output[] = ' ' . $sectionTitle; |
485
|
|
|
$output[] = '</a>'; |
486
|
|
|
$output[] = '<input type="hidden" name="TSFE_ADMIN_PANEL[display_' . |
487
|
|
|
$sectionSuffix . |
488
|
|
|
']" value="' . |
489
|
|
|
(int)$this->isAdminModuleOpen($sectionSuffix) . |
490
|
|
|
'" />'; |
491
|
|
|
|
492
|
|
|
return implode('', $output); |
493
|
|
|
} |
494
|
|
|
} |
495
|
|
|
|