mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?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\FormFactoryBuilder;
|
|
use Symfony\Component\Form\FormFactoryBuilderInterface;
|
|
use Symfony\Component\Form\FormFactoryInterface;
|
|
|
|
/**
|
|
* Plumbing for iTop custom form builder.
|
|
*/
|
|
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
|
|
{
|
|
return (new FormFactoryBuilder())
|
|
->addExtension(new HttpFoundationExtension())
|
|
->addTypeExtension(new FormTypeExtension())
|
|
->setResolvedTypeFactory(new ResolvedFormTypeFactory());
|
|
}
|
|
|
|
/**
|
|
* This class cannot be instantiated.
|
|
*/
|
|
private function __construct()
|
|
{
|
|
}
|
|
} |