/** * Renders a "new" button to be placed in the doc header. * * @return string */ public function render() { $output = ''; // Initialize variable as string. if ($this->getModuleLoader()->copeWithPageTree()) { $moduleCodes = ModuleService::getInstance()->getModulesForCurrentPid(); $output = $this->assembleDataTypeTab($moduleCodes); } return $output; }
/** * Return the Vidi module code which is stored in TBE_MODULES_EXT * * @return string */ public function getVidiModuleCode() { if ($this->copeWithPageTree()) { $userPreferenceKey = sprintf('Vidi_pid_%s', $this->getCurrentPid()); if (GeneralUtility::_GP(Parameter::SUBMODULE)) { $subModuleCode = GeneralUtility::_GP(Parameter::SUBMODULE); BackendUserPreferenceService::getInstance()->set($userPreferenceKey, $subModuleCode); } else { $defaultModuleCode = BackendUserPreferenceService::getInstance()->get($userPreferenceKey); if (empty($defaultModuleCode)) { $defaultModuleCode = 'VidiTtContentM1'; // hard-coded submodule BackendUserPreferenceService::getInstance()->set($userPreferenceKey, $defaultModuleCode); } $vidiModules = ModuleService::getInstance()->getModulesForCurrentPid(); if (empty($vidiModules)) { $subModuleCode = $defaultModuleCode; } elseif (isset($vidiModules[$defaultModuleCode])) { $subModuleCode = $defaultModuleCode; } else { $subModuleCode = ModuleService::getInstance()->getFirstModuleForPid($this->getCurrentPid()); } } } else { $moduleCode = $this->getSignature(); // Remove first part which is separated "_" $delimiter = strpos($moduleCode, '_') + 1; $subModuleCode = substr($moduleCode, $delimiter); } return $subModuleCode; }