initialize(); $tSconfig = BackendUtility::getPagesTSconfig($this->getPid()); $this->addCaptchaOption($params); $this->addStateOption($params); $tab = $params['config']['itemsProcFuncTab'] . '.'; if (!empty($tSconfig['tx_femanager.']['flexForm.'][$tab]['addFieldOptions.'])) { $options = $tSconfig['tx_femanager.']['flexForm.'][$tab]['addFieldOptions.']; foreach ((array)$options as $value => $label) { $params['items'][] = [ StringUtility::startsWith($label, 'LLL:') ? $this->languageService->sL($label) : $label, $value ]; } } } /** * Add captcha option * * @param array $params */ protected function addCaptchaOption(&$params) { if (ExtensionManagementUtility::isLoaded('sr_freecap')) { $params['items'][] = [ $this->languageService->sL($this->localLangPrefix . 'tx_femanager_domain_model_user.captcha'), 'captcha' ]; } } /** * Add captcha option * * @param array $params */ protected function addStateOption(&$params) { if (ExtensionManagementUtility::isLoaded('static_info_tables')) { $params['items'][] = [ $this->languageService->sL($this->localLangPrefix . 'tx_femanager_domain_model_user.state'), 'state' ]; } } /** * Read pid from current URL * URL example: * http://femanager.localhost.de/typo3/alt_doc.php?&returnUrl= * %2Ftypo3%2Fsysext%2Fcms%2Flayout%2Fdb_layout.php * %3Fid%3D17%23element-tt_content-14 * &edit[tt_content][14]=edit * * @return int */ protected function getPid() { $pid = 0; $backUrl = str_replace('?', '&', GeneralUtility::_GP('returnUrl')); $urlParts = GeneralUtility::trimExplode('&', $backUrl, true); foreach ($urlParts as $part) { if (stristr($part, 'id=')) { $pid = str_replace('id=', '', $part); } } return (int)$pid; } /** * Initialize * * @SuppressWarnings(PHPMD.Superglobals) */ protected function initialize() { $this->languageService = $GLOBALS['LANG']; } }