/** * Helper function to find the parents class recordType * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject * @return string */ public function render(\EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject) { $classSettings = $this->configurationManager->getExtbaseClassConfiguration($domainObject->getParentClass()); if (isset($classSettings['recordType'])) { $parentRecordType = \EBT\ExtensionBuilder\Utility\Tools::convertClassNameToRecordType($classSettings['recordType']); } else { $parentRecordType = \EBT\ExtensionBuilder\Utility\Tools::convertClassNameToRecordType($domainObject->getParentClass()); $existingTypes = $GLOBALS['TCA'][$domainObject->getDatabaseTableName()]['types']; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Parent Record type: ' . $parentRecordType, 'extension_builder', 2, $existingTypes); if (is_array($existingTypes) && !isset($existingTypes[$parentRecordType])) { // no types field for parent record type configured, use the default type 1 if (isset($existingTypes['1'])) { $parentRecordType = 1; } else { //if it not exists get first existing key $parentRecordType = reset(array_keys($existingTypes)); } } } $this->templateVariableContainer->add('parentModelName', end(explode('\\', $domainObject->getParentClass()))); $this->templateVariableContainer->add('parentRecordType', $parentRecordType); $content = $this->renderChildren(); $this->templateVariableContainer->remove('parentRecordType'); $this->templateVariableContainer->remove('parentModelName'); return $content; }