‪TYPO3CMS  9.5
FrontendHooks.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
21 
27 {
35  public function ‪displayPreviewInfoMessage($params, ‪TypoScriptFrontendController $controller)
36  {
37  if (!$controller->fePreview || $controller->‪doWorkspacePreview() || ($controller->config['config']['disablePreviewNotification'] ?? false)) {
38  return;
39  }
40  if ($controller->config['config']['message_preview']) {
41  $message = $controller->config['config']['message_preview'];
42  } else {
43  $label = $this->‪getLanguageService()->‪sL('LLL:EXT:core/Resources/Private/Language/locallang_tsfe.xlf:preview');
44  $styles = [];
45  $styles[] = 'position: fixed';
46  $styles[] = 'top: 15px';
47  $styles[] = 'right: 15px';
48  $styles[] = 'padding: 8px 18px';
49  $styles[] = 'background: #fff3cd';
50  $styles[] = 'border: 1px solid #ffeeba';
51  $styles[] = 'font-family: sans-serif';
52  $styles[] = 'font-size: 14px';
53  $styles[] = 'font-weight: bold';
54  $styles[] = 'color: #856404';
55  $styles[] = 'z-index: 20000';
56  $styles[] = 'user-select: none';
57  $styles[] = 'pointer-events: none';
58  $styles[] = 'text-align: center';
59  $styles[] = 'border-radius: 2px';
60  $message = '<div id="typo3-preview-info" style="' . implode(';', $styles) . '">' . htmlspecialchars($label) . '</div>';
61  }
62  if (!empty($message)) {
63  $controller->content = str_ireplace('</body>', $message . '</body>', $controller->content);
64  }
65  }
66 
70  protected function ‪getLanguageService()
71  {
72  return ‪$GLOBALS['LANG'];
73  }
74 }
‪TYPO3\CMS\Frontend\Hooks\FrontendHooks\getLanguageService
‪LanguageService getLanguageService()
Definition: FrontendHooks.php:70
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\doWorkspacePreview
‪bool doWorkspacePreview()
Definition: TypoScriptFrontendController.php:4246
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:158
‪TYPO3\CMS\Frontend\Hooks
Definition: FrontendHooks.php:4
‪TYPO3\CMS\Frontend\Hooks\FrontendHooks\displayPreviewInfoMessage
‪displayPreviewInfoMessage($params, TypoScriptFrontendController $controller)
Definition: FrontendHooks.php:35
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:97
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Frontend\Hooks\FrontendHooks
Definition: FrontendHooks.php:27