public static registerFluidFlexFormTable ( mixed $table, mixed $fieldName, mixed $templateFilename, mixed $variables = [], $section = NULL, $paths = NULL ) : void | ||
$table | mixed | The SQL table this FlexForm is bound to |
$fieldName | mixed | The SQL field this FlexForm is bound to |
$templateFilename | mixed | Location of the Fluid template containing field definitions |
$variables | mixed | Optional array of variables to pass to Fluid template |
Результат | void |
public static function registerFluidFlexFormTable($table, $fieldName, $templateFilename, $variables = array(), $section = NULL, $paths = NULL)
{
/** @var $objectManager ObjectManagerInterface */
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
/** @var $provider ProviderInterface */
$provider = $objectManager->get('FluidTYPO3\\Flux\\Provider\\Provider');
$provider->setTableName($table);
$provider->setFieldName($fieldName);
$provider->setTemplatePathAndFilename($templateFilename);
$provider->setTemplateVariables($variables);
$provider->setTemplatePaths($paths);
$provider->setConfigurationSectionName($section);
self::registerConfigurationProvider($provider);
}
/** * @test */ public function canRegisterStandaloneTemplateForTable() { $service = $this->createFluxServiceInstance(); $variables = array('test' => 'test'); $paths = array('templateRootPath' => 'EXT:flux/Resources/Private/Templates'); $table = 'fake'; $fieldName = NULL; $providerClassName = 'FluidTYPO3\\Flux\\Provider\\ProviderInterface'; $relativeTemplatePathAndFilename = self::FIXTURE_TEMPLATE_ABSOLUTELYMINIMAL; $record = Records::$contentRecordWithoutParentAndWithoutChildren; $absoluteTemplatePathAndFilename = GeneralUtility::getFileAbsFileName($relativeTemplatePathAndFilename); $configurationSectionName = 'Configuration'; Core::registerFluidFlexFormTable($table, $fieldName, $relativeTemplatePathAndFilename, $variables, $configurationSectionName, $paths); $detectedProvider = $service->resolvePrimaryConfigurationProvider($table, $fieldName, $record); $this->assertInstanceOf($providerClassName, $detectedProvider); $this->assertSame($absoluteTemplatePathAndFilename, $detectedProvider->getTemplatePathAndFilename($record)); $this->assertSame(PathUtility::translatePath($paths), $detectedProvider->getTemplatePaths($record)); }