4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Form
;
14 use Symfony\Component\OptionsResolver\OptionsResolverInterface
;
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 interface FormTypeInterface
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.
27 * @see FormTypeExtensionInterface::buildForm()
29 * @param FormBuilderInterface $builder The form builder
30 * @param array $options The options
32 public function buildForm(FormBuilderInterface
$builder, array $options);
35 * Builds the form view.
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.
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.
44 * @see FormTypeExtensionInterface::buildView()
46 * @param FormView $view The view
47 * @param FormInterface $form The form
48 * @param array $options The options
50 public function buildView(FormView
$view, FormInterface
$form, array $options);
53 * Finishes the form view.
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.
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.
63 * @see FormTypeExtensionInterface::finishView()
65 * @param FormView $view The view
66 * @param FormInterface $form The form
67 * @param array $options The options
69 public function finishView(FormView
$view, FormInterface
$form, array $options);
72 * Sets the default options for this type.
74 * @param OptionsResolverInterface $resolver The resolver for the options.
76 public function setDefaultOptions(OptionsResolverInterface
$resolver);
79 * Returns the name of the parent type.
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.
85 * @return string|null|FormTypeInterface The name of the parent type if any, null otherwise.
87 public function getParent();
90 * Returns the name of this type.
92 * @return string The name of this type
94 public function getName();