TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
workspaces/Classes/Controller/AbstractController.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Workspaces\Controller;
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 
25 
30 {
34  protected $defaultViewObjectName = BackendTemplateView::class;
35 
39  protected $view;
40 
44  protected $extensionName = 'Workspaces';
45 
49  protected $pageRenderer;
50 
54  protected $pageId;
55 
61  protected function initializeAction()
62  {
63  $this->pageRenderer = $this->getPageRenderer();
64  // @todo Evaluate how the intval() call can be used with Extbase validators/filters
65  $this->pageId = (int)GeneralUtility::_GP('id');
66  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
67  $lang = $this->getLanguageService();
68  $icons = [
69  'language' => $iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL)->render(),
70  'integrity' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
71  'success' => $iconFactory->getIcon('status-dialog-ok', Icon::SIZE_SMALL)->render(),
72  'info' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
73  'warning' => $iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render(),
74  'error' => $iconFactory->getIcon('status-dialog-error', Icon::SIZE_SMALL)->render()
75  ];
76  $this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons);
77  $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
78  $this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1);
79  $this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection());
80  $this->pageRenderer->addInlineLanguageLabelArray([
81  'title' => $lang->getLL('title'),
82  'path' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path'),
83  'table' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.table'),
84  'depth' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_perm.xlf:Depth'),
85  'depth_0' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
86  'depth_1' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
87  'depth_2' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
88  'depth_3' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
89  'depth_4' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
90  'depth_infi' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi')
91  ]);
92  $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf');
93  $this->assignExtensionSettings();
94  }
95 
101  protected function assignExtensionSettings()
102  {
103  $extension = [
104  'AdditionalColumn' => [
105  'Definition' => [],
106  'Handler' => [],
107  ],
108  ];
109 
110  $extension['AdditionalColumn']['Definition'] = $this->getAdditionalColumnService()->getDefinition();
111  $extension['AdditionalColumn']['Handler'] = $this->getAdditionalColumnService()->getHandler();
112  $this->pageRenderer->addInlineSetting('Workspaces', 'extension', $extension);
113  }
114 
120  protected function getLanguageSelection()
121  {
122  $language = 'all';
123  $backendUser = $this->getBackendUser();
124  if (isset($backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'])) {
125  $language = $backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'];
126  }
127  return $language;
128  }
129 
133  protected function getAdditionalColumnService()
134  {
135  return $this->objectManager->get(AdditionalColumnService::class);
136  }
137 
141  protected function getAdditionalResourceService()
142  {
143  return $this->objectManager->get(AdditionalResourceService::class);
144  }
145 
149  protected function getBackendUser()
150  {
151  return $GLOBALS['BE_USER'];
152  }
153 
157  protected function getLanguageService()
158  {
159  return $GLOBALS['LANG'];
160  }
161 
165  protected function getPageRenderer()
166  {
167  return GeneralUtility::makeInstance(PageRenderer::class);
168  }
169 }
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)