1 | <?php |
||
23 | class BootstrapFormExtension extends Twig_Extension |
||
24 | { |
||
25 | /** @var string */ |
||
26 | private $style; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $colSize = 'lg'; |
||
30 | |||
31 | /** @var integer */ |
||
32 | private $widgetCol = 10; |
||
33 | |||
34 | /** @var integer */ |
||
35 | private $labelCol = 2; |
||
36 | |||
37 | /** @var integer */ |
||
38 | private $simpleCol = false; |
||
39 | |||
40 | /** @var array */ |
||
41 | private $settingsStack = array(); |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function getFunctions() |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function getName() |
||
91 | |||
92 | /** |
||
93 | * Sets the style. |
||
94 | * |
||
95 | * @param string $style Name of the style |
||
96 | */ |
||
97 | public function setStyle($style) |
||
101 | |||
102 | /** |
||
103 | * Returns the style. |
||
104 | * |
||
105 | * @return string Name of the style |
||
106 | */ |
||
107 | public function getStyle() |
||
111 | |||
112 | /** |
||
113 | * Sets the column size. |
||
114 | * |
||
115 | * @param string $colSize Column size (xs, sm, md or lg) |
||
116 | */ |
||
117 | public function setColSize($colSize) |
||
121 | |||
122 | /** |
||
123 | * Returns the column size. |
||
124 | * |
||
125 | * @return string Column size (xs, sm, md or lg) |
||
126 | */ |
||
127 | public function getColSize() |
||
131 | |||
132 | /** |
||
133 | * Sets the number of columns of widgets. |
||
134 | * |
||
135 | * @param integer $widgetCol Number of columns. |
||
136 | */ |
||
137 | public function setWidgetCol($widgetCol) |
||
141 | |||
142 | /** |
||
143 | * Returns the number of columns of widgets. |
||
144 | * |
||
145 | * @return integer Number of columns.Class |
||
146 | */ |
||
147 | public function getWidgetCol() |
||
151 | |||
152 | /** |
||
153 | * Sets the number of columns of labels. |
||
154 | * |
||
155 | * @param integer $labelCol Number of columns. |
||
156 | */ |
||
157 | public function setLabelCol($labelCol) |
||
161 | |||
162 | /** |
||
163 | * Returns the number of columns of labels. |
||
164 | * |
||
165 | * @return integer Number of columns. |
||
166 | */ |
||
167 | public function getLabelCol() |
||
171 | |||
172 | /** |
||
173 | * Sets the number of columns of simple widgets. |
||
174 | * |
||
175 | * @param integer $simpleCol Number of columns. |
||
176 | */ |
||
177 | public function setSimpleCol($simpleCol) |
||
181 | |||
182 | /** |
||
183 | * Returns the number of columns of simple widgets. |
||
184 | * |
||
185 | * @return integer Number of columns. |
||
186 | */ |
||
187 | public function getSimpleCol() |
||
191 | |||
192 | /** |
||
193 | * Backup the form settings to the stack. |
||
194 | * |
||
195 | * @internal Should only be used at the beginning of form_start. This allows |
||
196 | * a nested subform to change its settings without affecting its |
||
197 | * parent form. |
||
198 | */ |
||
199 | public function backupFormSettings() |
||
211 | |||
212 | /** |
||
213 | * Restore the form settings from the stack. |
||
214 | * |
||
215 | * @internal Should only be used at the end of form_end. |
||
216 | * @see backupFormSettings |
||
217 | */ |
||
218 | public function restoreFormSettings() |
||
232 | |||
233 | /** |
||
234 | * @param string $label |
||
235 | * @param string $value |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | public function formControlStaticFunction($label, $value) |
||
246 | } |
||
247 |