/**
* @param array $row
* @return Form|NULL
*/
public function getForm(array $row)
{
if (NULL !== $this->form) {
return $this->form;
}
$templatePathAndFilename = $this->getTemplatePathAndFilename($row);
if (FALSE === file_exists($templatePathAndFilename)) {
return NULL;
}
$section = $this->getConfigurationSectionName($row);
$formName = 'form';
$paths = $this->getTemplatePaths($row);
$extensionKey = $this->getExtensionKey($row);
$extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
$fieldName = $this->getFieldName($row);
// Special case: when saving a new record variable $row[$fieldName] is already an array
// and must not be processed by the configuration service.
if (FALSE === is_array($row[$fieldName])) {
$variables = $this->configurationService->convertFlexFormContentToArray($row[$fieldName]);
} else {
$variables = array();
}
$variables['record'] = $row;
$variables = GeneralUtility::array_merge_recursive_overrule($this->templateVariables, $variables);
$form = $this->configurationService->getFormFromTemplateFile($templatePathAndFilename, $section, $formName, $paths, $extensionName, $variables);
$form = $this->setDefaultValuesInFieldsWithInheritedValues($form, $row);
return $form;
}