mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°8772 - Form dependencies manager implementation
- Form SDK implementation - Basic Forms - Dynamics Forms - Basic Blocks + Data Model Block - Form Compilation - Turbo integration
This commit is contained in:
57
sources/Forms/Forms.php
Normal file
57
sources/Forms/Forms.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2025 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Forms;
|
||||
|
||||
use Combodo\iTop\Forms\FormBuilder\FormTypeExtension;
|
||||
use Combodo\iTop\Forms\FormBuilder\ResolvedFormTypeFactory;
|
||||
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
|
||||
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
|
||||
use Symfony\Component\Form\FormFactoryBuilder;
|
||||
use Symfony\Component\Form\FormFactoryBuilderInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
|
||||
/**
|
||||
* Form.
|
||||
*
|
||||
* @package Combodo\iTop\Forms
|
||||
* @since 3.3.0
|
||||
*/
|
||||
final class Forms
|
||||
{
|
||||
/**
|
||||
* Creates a form factory with the iTop configuration.
|
||||
*/
|
||||
public static function createFormFactory(): FormFactoryInterface
|
||||
{
|
||||
return self::createFormFactoryBuilder()->getFormFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form factory builder with the iTop configuration.
|
||||
*/
|
||||
public static function createFormFactoryBuilder(): FormFactoryBuilderInterface
|
||||
{
|
||||
// Set up the Validator component
|
||||
$validator = Validation::createValidatorBuilder()
|
||||
->enableAttributeMapping()->getValidator();
|
||||
|
||||
return (new FormFactoryBuilder())
|
||||
->addExtension(new HttpFoundationExtension())
|
||||
->addExtension(new ValidatorExtension($validator))
|
||||
->addTypeExtension(new FormTypeExtension())
|
||||
->setResolvedTypeFactory(new ResolvedFormTypeFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* This class cannot be instantiated.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user