[BUGFIX] Remove wrong break; statement in rootline check
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Hooks / FrontendHooks.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Hooks;
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
17 use TYPO3\CMS\Core\Localization\LanguageService;
18 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
19
20 /**
21 * Uses frontend hooks to show preview information
22 */
23 class FrontendHooks
24 {
25 /**
26 * Include the preview block in case we're looking at a hidden page
27 * in the LIVE workspace
28 *
29 * @param array $params
30 * @param TypoScriptFrontendController $pObj
31 * @return string
32 */
33 public function hook_previewInfo($params, $pObj)
34 {
35 if (!$pObj->fePreview || $pObj->doWorkspacePreview()) {
36 return '';
37 }
38 if ($pObj->config['config']['message_preview']) {
39 $message = $pObj->config['config']['message_preview'];
40 } else {
41 $label = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_tsfe.xlf:preview');
42 $styles = [];
43 $styles[] = 'position: fixed';
44 $styles[] = 'top: 15px';
45 $styles[] = 'right: 15px';
46 $styles[] = 'padding: 8px 18px';
47 $styles[] = 'background: #fff3cd';
48 $styles[] = 'border: 1px solid #ffeeba';
49 $styles[] = 'font-family: sans-serif';
50 $styles[] = 'font-size: 14px';
51 $styles[] = 'font-weight: bold';
52 $styles[] = 'color: #856404';
53 $styles[] = 'z-index: 20000';
54 $styles[] = 'user-select: none';
55 $styles[] = 'pointer-events: none';
56 $styles[] = 'text-align: center';
57 $styles[] = 'border-radius: 2px';
58 $message = '<div id="typo3-preview-info" style="' . implode(';', $styles) . '">' . htmlspecialchars($label) . '</div>';
59 }
60 return $message;
61 }
62
63 /**
64 * @return LanguageService
65 */
66 protected function getLanguageService()
67 {
68 return $GLOBALS['LANG'];
69 }
70 }