‪TYPO3CMS  10.4
BackendUtilityHook.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
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 
19 
27 
33 {
46  public function ‪preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
47  {
48  if (‪$GLOBALS['BE_USER']->workspace !== 0) {
49  $viewScript = (string)GeneralUtility::makeInstance(PreviewUriBuilder::class)->buildUriForWorkspaceSplitPreview((int)$pageUid);
50  $viewScript .= $additionalGetVars ?: '';
51  }
52  }
53 
61  public function ‪makeEditForm_accessCheck($params)
62  {
63  if (‪$GLOBALS['BE_USER']->workspace !== 0 && ‪BackendUtility::isTableWorkspaceEnabled($params['table'])) {
64  $record = ‪BackendUtility::getRecordWSOL($params['table'], $params['uid']);
65  if (abs($record['t3ver_stage']) > ‪StagesService::STAGE_EDIT_ID) {
66  $stages = GeneralUtility::makeInstance(StagesService::class);
67  $stageName = $stages->getStageTitle($record['t3ver_stage']);
68  $editingName = $stages->getStageTitle(‪StagesService::STAGE_EDIT_ID);
69  $message = $this->‪getLanguageService()->‪sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:info.elementAlreadyModified');
70  $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, sprintf($message, $stageName, $editingName), '', ‪FlashMessage::INFO, true);
72  $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
74  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
75  $defaultFlashMessageQueue->enqueue($flashMessage);
76  }
77  }
78  return $params['hasAccess'];
79  }
80 
85  {
86  return ‪$GLOBALS['LANG'] ?? null;
87  }
88 }
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook\makeEditForm_accessCheck
‪bool makeEditForm_accessCheck($params)
Definition: BackendUtilityHook.php:61
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook\preProcess
‪preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
Definition: BackendUtilityHook.php:46
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled
‪static bool isTableWorkspaceEnabled($table)
Definition: BackendUtility.php:4021
‪TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder
Definition: PreviewUriBuilder.php:43
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook\getLanguageService
‪LanguageService null getLanguageService()
Definition: BackendUtilityHook.php:84
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordWSOL
‪static array getRecordWSOL( $table, $uid, $fields=' *', $where='', $useDeleteClause=true, $unsetMovePointers=false)
Definition: BackendUtility.php:139
‪TYPO3\CMS\Workspaces\Service\StagesService\STAGE_EDIT_ID
‪const STAGE_EDIT_ID
Definition: StagesService.php:39
‪TYPO3\CMS\Workspaces\Service\StagesService
Definition: StagesService.php:33
‪TYPO3\CMS\Core\Messaging\AbstractMessage\INFO
‪const INFO
Definition: AbstractMessage.php:28
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:24
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Messaging\FlashMessageService
Definition: FlashMessageService.php:27
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook
Definition: BackendUtilityHook.php:33
‪TYPO3\CMS\Workspaces\Hook
Definition: BackendUtilityHook.php:18