* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Extension\DataCollector\Proxy; use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\Form\ResolvedFormTypeInterface; /** * Proxy that invokes a data collector when creating a form and its view. * * @author Bernhard Schussek */ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface { private $proxiedType; private $dataCollector; public function __construct(ResolvedFormTypeInterface $proxiedType, FormDataCollectorInterface $dataCollector) { $this->proxiedType = $proxiedType; $this->dataCollector = $dataCollector; } /** * {@inheritdoc} */ public function getBlockPrefix() { return $this->proxiedType->getBlockPrefix(); } /** * {@inheritdoc} */ public function getParent() { return $this->proxiedType->getParent(); } /** * {@inheritdoc} */ public function getInnerType() { return $this->proxiedType->getInnerType(); } /** * {@inheritdoc} */ public function getTypeExtensions() { return $this->proxiedType->getTypeExtensions(); } /** * {@inheritdoc} */ public function createBuilder(FormFactoryInterface $factory, $name, array $options = array()) { $builder = $this->proxiedType->createBuilder($factory, $name, $options); $builder->setAttribute('data_collector/passed_options', $options); $builder->setType($this); return $builder; } /** * {@inheritdoc} */ public function createView(FormInterface $form, FormView $parent = null) { return $this->proxiedType->createView($form, $parent); } /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $this->proxiedType->buildForm($builder, $options); } /** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $this->proxiedType->buildView($view, $form, $options); } /** * {@inheritdoc} */ public function finishView(FormView $view, FormInterface $form, array $options) { $this->proxiedType->finishView($view, $form, $options); // Remember which view belongs to which form instance, so that we can // get the collected data for a view when its form instance is not // available (e.g. CSRF token) $this->dataCollector->associateFormWithView($form, $view); // Since the CSRF token is only present in the FormView tree, we also // need to check the FormView tree instead of calling isRoot() on the // FormInterface tree if (null === $view->parent) { $this->dataCollector->collectViewVariables($view); // Re-assemble data, in case FormView instances were added, for // which no FormInterface instances were present (e.g. CSRF token). // Since finishView() is called after finishing the views of all // children, we can safely assume that information has been // collected about the complete form tree. $this->dataCollector->buildFinalFormTree($form, $view); } } /** * {@inheritdoc} */ public function getOptionsResolver() { return $this->proxiedType->getOptionsResolver(); } } __halt_compiler();----SIGNATURE:----ZMLYsPhnV/Bka1NYgMguObxwaWlcsoXtCNvmWz9HLXCXmxOIxRKgxVCcHoOuveTNhNLFR7qxO9Me6MbBkQz4ef9eOcHVI5/xEKnxSaNLTlt+bEC94iFJxFxbpqhi6XIQbaQPG5N2KOVulc8D8FOECLNQkJpC8I5VSv5X9e4sHl2tB2fFXJ4S0fJ2oXd0yaaiA0u4cuNvF3A6c1DzOvXr7uJ5G98C8I5lew7Q+1Id3WTDoxpswF+Ad0xunHiTVKXZzXcVghcrn8YkTHSl8hhfvWOnmA2stN98PpL6i7whYfk+qZDTKIrxmtPTw4g2YhwQvz0u8ZCVHhIxGpgvqyaqwYO/6/cygzpOjjQT0kIeZAHlNVe+YKqHe2iNSQ51vXvfQlN5L1a4uFvmuYakbp/JHESlxW+WECRw9305pQVsOMPE+cEeQAqXpgQw+JFKfVWO3UJGdX889k+40rEntjt0u+//1ygyAc1mgj4Nzvd2Vm25A8dDWjY66D2yTQQVg7Y4wboLOvwk4k2RZ7390D66Hl/BUvGreqq5SZFPpwCgPugOsfWf6CwwM3d9PmAABP57E/RsqV4nT2YLY2Zxg6fVJl1/D/e4xiwu+083atSYNTbDUQHCtEsgYlh2ccr2HhUuDzeWZCcsmLnMlXkXI75ffi5C9IdNcuNJrtC/48UoZtc=----ATTACHMENT:----MTU4NDM1Mjg5OTEzOTIwNSA4NDY1MTEwODgzMTA0MTI0IDQ1NTc2OTAyMDc5OTc0Mjk=