]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/form/Symfony/Component/Form/FormTypeInterface.php
twig implementation
[github/wallabag/wallabag.git] / vendor / symfony / form / Symfony / Component / Form / FormTypeInterface.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Form;
13
14 use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16 /**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19 interface FormTypeInterface
20 {
21 /**
22 * Builds the form.
23 *
24 * This method is called for each type in the hierarchy starting form the
25 * top most type. Type extensions can further modify the form.
26 *
27 * @see FormTypeExtensionInterface::buildForm()
28 *
29 * @param FormBuilderInterface $builder The form builder
30 * @param array $options The options
31 */
32 public function buildForm(FormBuilderInterface $builder, array $options);
33
34 /**
35 * Builds the form view.
36 *
37 * This method is called for each type in the hierarchy starting form the
38 * top most type. Type extensions can further modify the view.
39 *
40 * A view of a form is built before the views of the child forms are built.
41 * This means that you cannot access child views in this method. If you need
42 * to do so, move your logic to {@link finishView()} instead.
43 *
44 * @see FormTypeExtensionInterface::buildView()
45 *
46 * @param FormView $view The view
47 * @param FormInterface $form The form
48 * @param array $options The options
49 */
50 public function buildView(FormView $view, FormInterface $form, array $options);
51
52 /**
53 * Finishes the form view.
54 *
55 * This method gets called for each type in the hierarchy starting form the
56 * top most type. Type extensions can further modify the view.
57 *
58 * When this method is called, views of the form's children have already
59 * been built and finished and can be accessed. You should only implement
60 * such logic in this method that actually accesses child views. For everything
61 * else you are recommended to implement {@link buildView()} instead.
62 *
63 * @see FormTypeExtensionInterface::finishView()
64 *
65 * @param FormView $view The view
66 * @param FormInterface $form The form
67 * @param array $options The options
68 */
69 public function finishView(FormView $view, FormInterface $form, array $options);
70
71 /**
72 * Sets the default options for this type.
73 *
74 * @param OptionsResolverInterface $resolver The resolver for the options.
75 */
76 public function setDefaultOptions(OptionsResolverInterface $resolver);
77
78 /**
79 * Returns the name of the parent type.
80 *
81 * You can also return a type instance from this method, although doing so
82 * is discouraged because it leads to a performance penalty. The support
83 * for returning type instances may be dropped from future releases.
84 *
85 * @return string|null|FormTypeInterface The name of the parent type if any, null otherwise.
86 */
87 public function getParent();
88
89 /**
90 * Returns the name of this type.
91 *
92 * @return string The name of this type
93 */
94 public function getName();
95 }