[FEATURE] EXT:form - integrate new form framework
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Domain / Factory / FormFactoryInterface.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Form\Domain\Factory;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use TYPO3\CMS\Form\Domain\Model\FormDefinition;
19
20 /**
21 * A Form Factory is responsible for building a {@link TYPO3\CMS\Form\Domain\Model\FormDefinition}.
22 * **Instead of implementing this interface, subclassing {@link AbstractFormFactory} is more appropriate
23 * in most cases**.
24 *
25 * A Form Factory can be called anytime a FormDefinition should be built; in most cases
26 * it is done through an invocation of a Form Rendering ViewHelper.
27 *
28 * Scope: frontend / backend
29 * @api
30 */
31 interface FormFactoryInterface
32 {
33
34 /**
35 * Build a form definition, depending on some configuration.
36 *
37 * The configuration array is factory-specific; for example a YAML or JSON factory
38 * could retrieve the path to the YAML / JSON file via the configuration array.
39 *
40 * @param array $configuration factory-specific configuration array
41 * @param string $prototypeName The name of the "PrototypeName" to use; it is factory-specific to implement this.
42 * @return FormDefinition a newly built form definition
43 * @api
44 */
45 public function build(array $configuration, string $prototypeName = null): FormDefinition;
46 }