forked from symfony/form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormTypeInterface.php
124 lines (112 loc) · 3.43 KB
/
FormTypeInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
interface FormTypeInterface
{
/**
* Builds the form.
*
* This method gets called for each type in the hierarchy starting form the
* top most type.
* Type extensions can further modify the form.
*
* @see FormTypeExtensionInterface::buildForm()
*
* @param FormBuilder $builder The form builder
* @param array $options The options
*/
function buildForm(FormBuilder $builder, array $options);
/**
* Builds the form view.
*
* This method gets called for each type in the hierarchy starting form the
* top most type.
* Type extensions can further modify the view.
*
* @see FormTypeExtensionInterface::buildView()
*
* @param FormView $view The view
* @param FormInterface $form The form
*/
function buildView(FormView $view, FormInterface $form);
/**
* Builds the form view.
*
* This method gets called for each type in the hierarchy starting form the
* top most type.
* Type extensions can further modify the view.
*
* Children views have been built when this method gets called so you get
* a chance to modify them.
*
* @see FormTypeExtensionInterface::buildViewBottomUp()
*
* @param FormView $view The view
* @param FormInterface $form The form
*/
function buildViewBottomUp(FormView $view, FormInterface $form);
/**
* Returns a builder for the current type.
*
* The builder is retrieved by going up in the type hierarchy when a type does
* not provide one.
*
* @param string $name The name of the builder
* @param FormFactoryInterface $factory The form factory
* @param array $options The options
*
* @return FormBuilder|null A form builder or null when the type does not have a builder
*/
function createBuilder($name, FormFactoryInterface $factory, array $options);
/**
* Returns the default options for this type.
*
* @param array $options
*
* @return array The default options
*/
function getDefaultOptions(array $options);
/**
* Returns the allowed option values for each option (if any).
*
* @param array $options
*
* @return array The allowed option values
*/
function getAllowedOptionValues(array $options);
/**
* Returns the name of the parent type.
*
* @param array $options
*
* @return string|null The name of the parent type if any otherwise null
*/
function getParent(array $options);
/**
* Returns the name of this type.
*
* @return string The name of this type
*/
function getName();
/**
* Adds extensions for this type.
*
* @param array $extensions An array of FormTypeExtensionInterface
*
* @throws UnexpectedTypeException if any extension does not implement FormTypeExtensionInterface
*/
function setExtensions(array $extensions);
/**
* Returns the extensions associated with this type.
*
* @return array An array of FormTypeExtensionInterface
*/
function getExtensions();
}