FluidTYPO3\Fluidcontent\Service\ConfigurationService::getContentElementFormInstances PHP Method

getContentElementFormInstances() public method

public getContentElementFormInstances ( ) : Form[][]
return FluidTYPO3\Flux\Form[][]
    public function getContentElementFormInstances()
    {
        $elements = array();
        $allTemplatePaths = $this->getContentConfiguration();
        $controllerName = 'Content';
        foreach ($allTemplatePaths as $registeredExtensionKey => $templatePathSet) {
            $files = array();
            $extensionKey = TRUE === isset($templatePathSet['extensionKey']) ? $templatePathSet['extensionKey'] : $registeredExtensionKey;
            $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
            $templatePaths = new TemplatePaths($templatePathSet);
            $viewContext = new ViewContext(NULL, $extensionKey);
            $viewContext->setTemplatePaths($templatePaths);
            $viewContext->setSectionName('Configuration');
            foreach ($templatePaths->getTemplateRootPaths() as $templateRootPath) {
                $files = GeneralUtility::getAllFilesAndFoldersInPath($files, rtrim($templateRootPath, '/') . '/' . $controllerName . '/', 'html');
                if (0 < count($files)) {
                    foreach ($files as $templateFilename) {
                        $actionName = pathinfo($templateFilename, PATHINFO_FILENAME);
                        $fileRelPath = $actionName . '.html';
                        $viewContext->setTemplatePathAndFilename($templateFilename);
                        $form = $this->getFormFromTemplateFile($viewContext);
                        if (TRUE === empty($form)) {
                            $this->sendDisabledContentWarning($templateFilename);
                            continue;
                        }
                        if (FALSE === $form->getEnabled()) {
                            $this->sendDisabledContentWarning($templateFilename);
                            continue;
                        }
                        $id = preg_replace('/[\\.\\/]/', '_', $registeredExtensionKey . '/' . $actionName . '.html');
                        $form->setOption('contentElementId', $registeredExtensionKey . ':' . $fileRelPath);
                        $elements[$registeredExtensionKey][$id] = $form;
                    }
                }
            }
        }
        return $elements;
    }