/** * Get starting page uid * current pid or given pid from Page TSConfig * * @return int */ protected function getStartPid() { $tsConfiguration = BackendUtility::getPagesTSconfig(BackendUtility::getPidFromBackendPage()); $startPid = 0; if (!empty($tsConfiguration['tx_powermail.']['flexForm.']['formSelection'])) { $startPid = $tsConfiguration['tx_powermail.']['flexForm.']['formSelection']; if ($startPid === 'current') { $startPid = BackendUtility::getPidFromBackendPage(); } } return (int) $startPid; }
/** * Create Array for Form Selection * Show all forms only from a pid and it's subpages: * tx_powermail.flexForm.formSelection = 123 * Show all forms only from this pid and it's subpages: * tx_powermail.flexForm.formSelection = current * If no TSConfig set, all forms will be shown * * @param array $params * @return void */ public function getForms(&$params) { $tsConfiguration = BackendUtility::getPagesTSconfig(BackendUtility::getPidFromBackendPage()); $language = $params['row']['sys_language_uid']; $startPid = 0; if (!empty($tsConfiguration['tx_powermail.']['flexForm.']['formSelection'])) { $startPid = $tsConfiguration['tx_powermail.']['flexForm.']['formSelection']; } $params['items'] = array(); foreach ($this->getAllForms($startPid, $language) as $form) { $params['items'][] = array(htmlspecialchars($form['title']), (int) $form['uid']); } }
/** * Extend dataType with TSConfig * * @param string $fieldType * @param array $types * @return array */ protected function extendTypeArrayWithTypoScriptTypes($fieldType, array $types) { $typoScript = BackendUtility::getPagesTSconfig(FrontendUtility::getCurrentPageIdentifier()); $configuration = $typoScript['tx_powermail.']['flexForm.']; if (!empty($configuration['type.']['addFieldOptions.'][$fieldType . '.']['dataType'])) { $types[$fieldType] = (int) $configuration['type.']['addFieldOptions.'][$fieldType . '.']['dataType']; } return $types; }