FluidTYPO3\Flux\Form::create PHP Method

create() public static method

public static create ( array $settings = [] ) : FormInterface
$settings array
return FormInterface
    public static function create(array $settings = array())
    {
        /** @var ObjectManagerInterface $objectManager */
        $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
        if (isset($settings['extensionName'])) {
            $className = FluxPackageFactory::getPackageWithFallback($settings['extensionName'])->getImplementation(FluxPackage::IMPLEMENTATION_FORM);
        } else {
            $className = get_called_class();
        }
        /** @var FormInterface $object */
        $object = $objectManager->get($className);
        return $object->modify($settings);
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function canSetDefaultValueFromCsvfAlreadyCorrectStrings()
 {
     $instance = Form::create(array())->createField('File', 'file');
     $defaultValue = 'testfile1.jpg|testfile1.jpg,testfile2.jpg|testfile2.jpg';
     $instance->setDefault($defaultValue);
     $this->assertSame($defaultValue, $instance->getDefault());
 }
All Usage Examples Of FluidTYPO3\Flux\Form::create