src/Form/Extension/EasyAdminExtension.php
public function finishView(FormView $view, FormInterface $form, array $options)
    {
        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (null === $request) {
            return;
        }

        if ($request->attributes->has('easyadmin')) {
            $easyadmin = $request->attributes->get('easyadmin');
            $entity = $easyadmin['entity'];
            $action = $easyadmin['view'];
            $fields = $entity[$action]['fields'] ?? [];
            $view->vars['easyadmin'] = [
                'entity' => $entity,
                'view' => $action,
                'item' => $easyadmin['item'],
                'field' => null,
                'form_group' => $form->getConfig()->getAttribute('easyadmin_form_group'),
                'form_tab' => $form->getConfig()->getAttribute('easyadmin_form_tab'),
            ];

            /*
             * Checks if current form view is direct child on the topmost form
             * (ie. this form view`s field exists in easyadmin configuration)
             */
            if (null !== $view->parent && null === $view->parent->parent) {
                $view->vars['easyadmin']['field'] = $fields[$view->vars['name']] ?? null;
            }
        }
    }
public function finishView(FormView $view, FormInterface $form, array $options)
    {
        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (null === $request) {
            return;
        }

        if ($request->attributes->has('easyadmin')) {
            $easyadmin = $request->attributes->get('easyadmin');
            $entity = $easyadmin['entity'];
            $action = $easyadmin['view'];
            $fields = $entity[$action]['fields'] ?? [];
            $view->vars['easyadmin'] = [
                'entity' => $entity,
                'view' => $action,
                'item' => $easyadmin['item'],
                'field' => null,
                'form_group' => $form->getConfig()->getAttribute('easyadmin_form_group'),
                'form_tab' => $form->getConfig()->getAttribute('easyadmin_form_tab'),
            ];

            /*
             * Checks if current form view is direct child on the topmost form
             * (ie. this form view`s field exists in easyadmin configuration)
             */
            if (null !== $view->parent && null === $view->parent->parent) {
                $view->vars['easyadmin']['field'] = $fields[$view->vars['name']] ?? null;
            }
        }
    }
{@inheritdoc}