configurationService = GeneralUtility::makeInstance(ConfigurationService::class); $this->mainConfiguration = $this->configurationService->getMainConfiguration(); } /** * Returns true if the module is * -> either enabled via TSConfig admPanel.enable * -> or any setting is overridden * override is a way to use functionality of the admin panel without displaying the admin panel to users * for example: hidden records or pages can be displayed by default * * @return bool */ public function isEnabled(): bool { $identifier = $this->getIdentifier(); $result = $this->isEnabledViaTsConfig(); if ($this->mainConfiguration['override.'][$identifier] ?? false) { $result = (bool)$this->mainConfiguration['override.'][$identifier]; } return $result; } /** * @inheritdoc */ public function setSubModules(array $subModules): void { $this->subModules = $subModules; } /** * @inheritdoc */ public function getSubModules(): array { return $this->subModules; } /** * @inheritdoc */ public function hasSubmoduleSettings(): bool { $hasSettings = false; foreach ($this->subModules as $subModule) { if ($subModule instanceof ModuleSettingsProviderInterface) { $hasSettings = true; break; } if ($subModule instanceof SubmoduleProviderInterface) { $hasSettings = $subModule->hasSubmoduleSettings(); } } return $hasSettings; } /** * Returns the current BE user. * * @return BackendUserAuthentication|FrontendBackendUserAuthentication */ protected function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } /** * Returns LanguageService * * @return LanguageService */ protected function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } /** * Returns true if TSConfig admPanel.enable is set for this module (or all modules) * * @return bool */ protected function isEnabledViaTsConfig(): bool { $result = false; $identifier = $this->getIdentifier(); if (!empty($this->mainConfiguration['enable.']['all'])) { $result = true; } elseif (!empty($this->mainConfiguration['enable.'][$identifier])) { $result = true; } return $result; } }