finishView example



    public function testBuildView()
    {
        $this->resolvedType->buildView(new FormView()$this->formFactory->create()[]);

        $this->assertSame([$this->parentType, $this->type, $this->extension1, $this->extension2]$this->calls['buildView']);
    }

    public function testFinishView()
    {
        $this->resolvedType->finishView(new FormView()$this->formFactory->create()[]);

        $this->assertSame([$this->parentType, $this->type, $this->extension1, $this->extension2]$this->calls['finishView']);
    }

    public function testGetBlockPrefix()
    {
        $resolvedType = new ResolvedFormType(new ConfigurableFormType());

        $this->assertSame('configurable_form_prefix', $resolvedType->getBlockPrefix());
    }

    
        // in a custom resolved form type.         $view = $type->createView($this$parent);

        $type->buildView($view$this$options);

        foreach ($this->children as $name => $child) {
            $view->children[$name] = $child->createView($view);
        }

        $this->sort($view->children);

        $type->finishView($view$this$options);

        return $view;
    }

    /** * Sorts view fields based on their priority value. */
    private function sort(array &$children): void
    {
        $c = [];
        $i = 0;
        

        if (null === $parent && $this->parent) {
            $parent = $this->parent->createView();
        }

        $type = $this->config->getType();
        $options = $this->config->getOptions();

        $view = $type->createView($this$parent);

        $type->buildView($view$this$options);
        $type->finishView($view$this$options);

        return $view;
    }

    /** * Unsupported method. */
    public function count(): int
    {
        return 0;
    }

    
foreach ($this->typeExtensions as $extension) {
            $extension->buildView($view$form$options);
        }
    }

    /** * @return void */
    public function finishView(FormView $view, FormInterface $form, array $options)
    {
        $this->parent?->finishView($view$form$options);

        $this->innerType->finishView($view$form$options);

        foreach ($this->typeExtensions as $extension) {
            /* @var FormTypeExtensionInterface $extension */
            $extension->finishView($view$form$options);
        }
    }

    public function getOptionsResolver(): OptionsResolver
    {
        

    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $this->proxiedType->buildView($view$form$options);
    }

    /** * @return void */
    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);

            
Home | Imprint | This part of the site doesn't use cookies.