public getFormFromTemplateFile ( FluidTYPO3\Flux\View\ViewContext $viewContext, string $formName = 'form' ) : |
||
$viewContext | FluidTYPO3\Flux\View\ViewContext | |
$formName | string | |
return |
/** * @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; }
/** * @param string $extension * @param string $contentType * @param string $version * @return string */ public function getIconFromVersion($extension, $contentType, $version = NULL) { $extensionKey = ExtensionNamingUtility::getExtensionKey($extension); $templatePathAndFilename = $this->resolveTemplateFileForVariant($extensionKey, $contentType, $extension, $version); $paths = $this->getViewConfigurationForExtensionName($extensionKey); $templatePaths = new TemplatePaths($paths); $viewContext = new ViewContext($templatePathAndFilename, $extensionKey); $viewContext->setTemplatePaths($templatePaths); $viewContext->setSectionName('Configuration'); $form = FluxService::getFormFromTemplateFile($viewContext); if (FALSE === $form instanceof Form) { return ''; } else { return MiscellaneousUtility::getIconForTemplate($form); } }