‪TYPO3CMS  9.5
BackendUtilityHook.php
Go to the documentation of this file.
1 <?php
2 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 
24 
30 {
43  public function ‪preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
44  {
45  if (‪$GLOBALS['BE_USER']->workspace !== 0) {
46  $viewScript = GeneralUtility::makeInstance(PreviewUriBuilder::class)->buildUriForWorkspaceSplitPreview((int)$pageUid, false);
47  $viewScript .= $additionalGetVars ?: '';
48  }
49  }
50 
58  public function ‪makeEditForm_accessCheck($params)
59  {
60  if (‪$GLOBALS['BE_USER']->workspace !== 0 && ‪$GLOBALS['TCA'][$params['table']]['ctrl']['versioningWS']) {
61  $record = ‪BackendUtility::getRecordWSOL($params['table'], $params['uid']);
62  if (abs($record['t3ver_stage']) > ‪StagesService::STAGE_EDIT_ID) {
63  $stages = GeneralUtility::makeInstance(StagesService::class);
64  $stageName = $stages->getStageTitle($record['t3ver_stage']);
65  $editingName = $stages->getStageTitle(‪StagesService::STAGE_EDIT_ID);
66  $message = ‪$GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:info.elementAlreadyModified');
67  $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, sprintf($message, $stageName, $editingName), '', ‪FlashMessage::INFO, true);
69  $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
71  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
72  $defaultFlashMessageQueue->enqueue($flashMessage);
73  }
74  }
75  return $params['hasAccess'];
76  }
77 }
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook\makeEditForm_accessCheck
‪bool makeEditForm_accessCheck($params)
Definition: BackendUtilityHook.php:58
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook\preProcess
‪preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
Definition: BackendUtilityHook.php:43
‪TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder
Definition: PreviewUriBuilder.php:39
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordWSOL
‪static array getRecordWSOL( $table, $uid, $fields=' *', $where='', $useDeleteClause=true, $unsetMovePointers=false)
Definition: BackendUtility.php:174
‪TYPO3\CMS\Workspaces\Service\StagesService\STAGE_EDIT_ID
‪const STAGE_EDIT_ID
Definition: StagesService.php:37
‪TYPO3\CMS\Workspaces\Service\StagesService
Definition: StagesService.php:31
‪TYPO3\CMS\Core\Messaging\AbstractMessage\INFO
‪const INFO
Definition: AbstractMessage.php:26
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:22
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Messaging\FlashMessageService
Definition: FlashMessageService.php:25
‪TYPO3\CMS\Workspaces\Hook\BackendUtilityHook
Definition: BackendUtilityHook.php:30
‪TYPO3\CMS\Workspaces\Hook
Definition: BackendUtilityHook.php:3