65 parent::initializeView(
$view);
67 $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
75 $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
77 $moduleName = $currentRequest->getPluginName();
80 if (count($getVars) === 0) {
81 $modulePrefix = strtolower(
'tx_' .
$extensionName .
'_' . $moduleName);
82 $getVars = [
'id',
'route', $modulePrefix];
84 $shortcutButton = $buttonBar->makeShortcutButton()
85 ->setModuleName($moduleName)
86 ->setGetVariables($getVars);
87 $buttonBar->addButton($shortcutButton);
97 $this->pageId = (int)GeneralUtility::_GP(
'id');
98 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
101 'language' => $iconFactory->getIcon(
'flags-multiple',
Icon::SIZE_SMALL)->render(),
102 'integrity' => $iconFactory->getIcon(
'status-dialog-information',
Icon::SIZE_SMALL)->render(),
103 'success' => $iconFactory->getIcon(
'status-dialog-ok',
Icon::SIZE_SMALL)->render(),
104 'info' => $iconFactory->getIcon(
'status-dialog-information',
Icon::SIZE_SMALL)->render(),
105 'warning' => $iconFactory->getIcon(
'status-dialog-warning',
Icon::SIZE_SMALL)->render(),
106 'error' => $iconFactory->getIcon(
'status-dialog-error',
Icon::SIZE_SMALL)->render()
108 $this->pageRenderer->addInlineSetting(
'Workspaces',
'icons',
$icons);
109 $this->pageRenderer->addInlineSetting(
'Workspaces',
'id', $this->pageId);
110 $this->pageRenderer->addInlineSetting(
'Workspaces',
'depth', $this->pageId === 0 ? 999 : 1);
112 $this->pageRenderer->addInlineLanguageLabelArray([
113 'title' => $lang->getLL(
'title'),
114 'path' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path'),
115 'table' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.table'),
116 'depth' => $lang->sL(
'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Depth'),
117 'depth_0' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
118 'depth_1' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
119 'depth_2' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
120 'depth_3' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
121 'depth_4' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
122 'depth_infi' => $lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi')
124 $this->pageRenderer->addInlineLanguageLabelFile(
'EXT:workspaces/Resources/Private/Language/locallang.xlf');
125 $states = $this->
getBackendUser()->uc[
'moduleData'][
'Workspaces'][
'States'];
126 $this->pageRenderer->addInlineSetting(
'Workspaces',
'States', $states);
129 $this->pageRenderer->addInlineLanguageLabelFile($localizationResource);
131 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
132 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Workspaces/Backend');
133 $this->pageRenderer->addInlineSetting(
'FormEngine',
'moduleUrl', (
string)
$uriBuilder->buildUriFromRoute(
'record_edit'));
134 $this->pageRenderer->addInlineSetting(
'RecordHistory',
'moduleUrl', (
string)
$uriBuilder->buildUriFromRoute(
'record_history'));
135 $this->pageRenderer->addInlineSetting(
'Workspaces',
'id', (
int)GeneralUtility::_GP(
'id'));
147 $moduleTemplate = $this->view->getModuleTemplate();
149 if (GeneralUtility::_GP(
'id')) {
152 $moduleTemplate->getDocHeaderComponent()->setMetaInformation($pageRecord);
156 $wsList = GeneralUtility::makeInstance(WorkspaceService::class)->getAvailableWorkspaces();
157 $activeWorkspace = $backendUser->workspace;
158 $performWorkspaceSwitch =
false;
162 if (!$backendUser->isAdmin()) {
163 $wsCur = [$activeWorkspace =>
true];
164 $wsList = array_intersect_key($wsList, $wsCur);
166 if ((
string)GeneralUtility::_GP(
'workspace') !==
'') {
167 $switchWs = (int)GeneralUtility::_GP(
'workspace');
168 if (array_key_exists($switchWs, $wsList) && $activeWorkspace != $switchWs) {
169 $activeWorkspace = $switchWs;
170 $backendUser->setWorkspace($activeWorkspace);
171 $performWorkspaceSwitch =
true;
178 $this->pageRenderer->addInlineSetting(
'Workspaces',
'isLiveWorkspace', (
int)$backendUser->workspace === 0);
179 $this->pageRenderer->addInlineSetting(
'Workspaces',
'workspaceTabs', $this->
prepareWorkspaceTabs($wsList, $activeWorkspace));
180 $this->pageRenderer->addInlineSetting(
'Workspaces',
'activeWorkspaceId', $activeWorkspace);
181 $workspaceIsAccessible = !($backendUser->workspace === 0 && !$backendUser->isAdmin());
182 $this->view->assignMultiple([
183 'showGrid' => $workspaceIsAccessible,
184 'showLegend' => $workspaceIsAccessible,
185 'pageUid' => (
int)GeneralUtility::_GP(
'id'),
186 'performWorkspaceSwitch' => $performWorkspaceSwitch,
188 'activeWorkspaceUid' => $activeWorkspace,
193 $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
194 $iconFactory = $moduleTemplate->getIconFactory();
195 $showButton = $buttonBar->makeLinkButton()
197 ->setClasses(
't3js-preview-link')
198 ->setShowLabelText(
true)
199 ->setTitle($this->
getLanguageService()->
sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:tooltip.generatePagePreview'))
200 ->setIcon($iconFactory->getIcon(
'actions-version-workspaces-preview-link',
Icon::SIZE_SMALL));
201 $buttonBar->addButton($showButton);
203 $backendUser->setAndSaveSessionData(
'tx_workspace_activeWorkspace', $activeWorkspace);
212 $wsService = GeneralUtility::makeInstance(WorkspaceService::class);
213 $wsList = $wsService->getAvailableWorkspaces();
217 $wsCur = [$activeWorkspace =>
true];
218 $wsList = array_intersect_key($wsList, $wsCur);
223 $this->view->assignMultiple([
224 'pageUid' => (
int)GeneralUtility::_GP(
'id'),
226 'showLegend' =>
true,
232 $this->pageRenderer->addInlineSetting(
'Workspaces',
'allView',
'1');
241 $wsService = GeneralUtility::makeInstance(WorkspaceService::class);
242 $wsList = $wsService->getAvailableWorkspaces();
244 $wsCur = [$activeWorkspace =>
true];
245 $wsList = array_intersect_key($wsList, $wsCur);
246 $this->view->assignMultiple([
247 'pageUid' => (
int)GeneralUtility::_GP(
'id'),
250 'activeWorkspaceUid' => $activeWorkspace,
252 $this->pageRenderer->addInlineSetting(
'Workspaces',
'singleView',
'1');
263 protected function prepareWorkspaceTabs(array $workspaceList,
int $activeWorkspace,
bool $showAllWorkspaceTab =
true)
269 'title' => $workspaceList[$activeWorkspace],
270 'itemId' =>
'workspace-' . $activeWorkspace,
271 'workspaceId' => $activeWorkspace,
276 if ($showAllWorkspaceTab) {
278 'title' =>
'All workspaces',
285 foreach ($workspaceList as $workspaceId => $workspaceTitle) {
286 if ($workspaceId === $activeWorkspace) {
290 'title' => $workspaceTitle,
291 'itemId' =>
'workspace-' . $workspaceId,
292 'workspaceId' => $workspaceId,
310 'workspace' => $workspaceId,
315 $this->uriBuilder->reset()->uriFor(
'fullIndex');
316 $parameters = array_merge($parameters, $this->uriBuilder->getArguments());
318 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
319 return (
string)
$uriBuilder->buildUriFromRoute(
'web_WorkspacesWorkspaces', $parameters);
328 'AdditionalColumn' => [
336 $this->pageRenderer->addInlineSetting(
'Workspaces',
'extension', $extension);
348 if ($pageUid > 0 && $workspaceUid > 0) {
368 if (isset($backendUser->uc[
'moduleData'][
'Workspaces'][$backendUser->workspace][
'language'])) {
369 $language = $backendUser->uc[
'moduleData'][
'Workspaces'][$backendUser->workspace][
'language'];
379 return $this->objectManager->get(AdditionalColumnService::class);
387 return $this->objectManager->get(AdditionalResourceService::class);
395 return GeneralUtility::makeInstance(PageRenderer::class);