TYPO3 CMS  TYPO3_8-7
AbstractController.php
Go to the documentation of this file.
1 <?php
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 
59  protected function initializeAction()
60  {
61  $this->pageRenderer = $this->getPageRenderer();
62  // @todo Evaluate how the (int) typecast can be used with Extbase validators/filters
63  $this->pageId = (int)GeneralUtility::_GP('id');
64  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
65  $lang = $this->getLanguageService();
66  $icons = [
67  'language' => $iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL)->render(),
68  'integrity' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
69  'success' => $iconFactory->getIcon('status-dialog-ok', Icon::SIZE_SMALL)->render(),
70  'info' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
71  'warning' => $iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render(),
72  'error' => $iconFactory->getIcon('status-dialog-error', Icon::SIZE_SMALL)->render()
73  ];
74  $this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons);
75  $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
76  $this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1);
77  $this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection());
78  $this->pageRenderer->addInlineLanguageLabelArray([
79  'title' => $lang->getLL('title'),
80  'path' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path'),
81  'table' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.table'),
82  'depth' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_perm.xlf:Depth'),
83  'depth_0' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
84  'depth_1' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
85  'depth_2' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
86  'depth_3' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
87  'depth_4' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
88  'depth_infi' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi')
89  ]);
90  $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf');
91  $this->assignExtensionSettings();
92  }
93 
97  protected function assignExtensionSettings()
98  {
99  $extension = [
100  'AdditionalColumn' => [
101  'Definition' => [],
102  'Handler' => [],
103  ],
104  ];
105 
106  $extension['AdditionalColumn']['Definition'] = $this->getAdditionalColumnService()->getDefinition();
107  $extension['AdditionalColumn']['Handler'] = $this->getAdditionalColumnService()->getHandler();
108  $this->pageRenderer->addInlineSetting('Workspaces', 'extension', $extension);
109  }
110 
116  protected function getLanguageSelection()
117  {
118  $language = 'all';
119  $backendUser = $this->getBackendUser();
120  if (isset($backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'])) {
121  $language = $backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'];
122  }
123  return $language;
124  }
125 
129  protected function getAdditionalColumnService()
130  {
131  return $this->objectManager->get(AdditionalColumnService::class);
132  }
133 
137  protected function getAdditionalResourceService()
138  {
139  return $this->objectManager->get(AdditionalResourceService::class);
140  }
141 
145  protected function getBackendUser()
146  {
147  return $GLOBALS['BE_USER'];
148  }
149 
153  protected function getLanguageService()
154  {
155  return $GLOBALS['LANG'];
156  }
157 
161  protected function getPageRenderer()
162  {
163  return GeneralUtility::makeInstance(PageRenderer::class);
164  }
165 }
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']