FluidTYPO3\Flux\Core::registerFluidFlexFormTable PHP Method

registerFluidFlexFormTable() public static method

Same as registerFluidFlexFormPlugin, but enables registering FlexForms for any TCA field (type "flex") or field whose TCA you have overridden to display as a FlexForm.
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
return 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);
    }

Usage Example

Esempio n. 1
0
 /**
  * @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));
 }