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
12namespace Symfony\Component\Form;
13
14use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16/**
17 * A wrapper for a form type and its extensions.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21interface ResolvedFormTypeInterface
22{
23    /**
24     * Returns the name of the type.
25     *
26     * @return string The type name.
27     */
28    public function getName();
29
30    /**
31     * Returns the parent type.
32     *
33     * @return ResolvedFormTypeInterface|null The parent type or null.
34     */
35    public function getParent();
36
37    /**
38     * Returns the wrapped form type.
39     *
40     * @return FormTypeInterface The wrapped form type.
41     */
42    public function getInnerType();
43
44    /**
45     * Returns the extensions of the wrapped form type.
46     *
47     * @return FormTypeExtensionInterface[] An array of {@link FormTypeExtensionInterface} instances.
48     */
49    public function getTypeExtensions();
50
51    /**
52     * Creates a new form builder for this type.
53     *
54     * @param FormFactoryInterface $factory The form factory.
55     * @param string               $name    The name for the builder.
56     * @param array                $options The builder options.
57     *
58     * @return FormBuilderInterface The created form builder.
59     */
60    public function createBuilder(FormFactoryInterface $factory, $name, array $options = array());
61
62    /**
63     * Creates a new form view for a form of this type.
64     *
65     * @param FormInterface $form   The form to create a view for.
66     * @param FormView      $parent The parent view or null.
67     *
68     * @return FormView The created form view.
69     */
70    public function createView(FormInterface $form, FormView $parent = null);
71
72    /**
73     * Configures a form builder for the type hierarchy.
74     *
75     * @param FormBuilderInterface $builder The builder to configure.
76     * @param array                $options The options used for the configuration.
77     */
78    public function buildForm(FormBuilderInterface $builder, array $options);
79
80    /**
81     * Configures a form view for the type hierarchy.
82     *
83     * It is called before the children of the view are built.
84     *
85     * @param FormView      $view    The form view to configure.
86     * @param FormInterface $form    The form corresponding to the view.
87     * @param array         $options The options used for the configuration.
88     */
89    public function buildView(FormView $view, FormInterface $form, array $options);
90
91    /**
92     * Finishes a form view for the type hierarchy.
93     *
94     * It is called after the children of the view have been built.
95     *
96     * @param FormView      $view    The form view to configure.
97     * @param FormInterface $form    The form corresponding to the view.
98     * @param array         $options The options used for the configuration.
99     */
100    public function finishView(FormView $view, FormInterface $form, array $options);
101
102    /**
103     * Returns the configured options resolver used for this type.
104     *
105     * @return OptionsResolverInterface The options resolver.
106     */
107    public function getOptionsResolver();
108}
109