public function onlyAction(Request $request, $key)
    {
        $ajaxTemplates = $this->container->getParameter('sulu_form.ajax_templates');

        if (!$ajaxTemplates[$key]) {
            throw new NotFoundHttpException();
        }

        $typeClass = $this->getTypeClass($key);
        /** @var AbstractType $type */
        $type = $this->get('form.registry')->getType($typeClass)->getInnerType();
        $this->form = $this->get('form.factory')->create($typeClass);
        $this->form->handleRequest($request);

        if ($this->form->isSubmitted()
            && $this->form->isValid()
            && $response = $this->handleFormOnlySubmit($request, $type)
        ) {
            // success form submit

            return $response;
        }

        return $this->render($ajaxTemplates[$key], ['form' => $this->form->createView()]);
    }
public function onlyAction(Request $request, $key)
    {
        $ajaxTemplates = $this->container->getParameter('sulu_form.ajax_templates');

        if (!$ajaxTemplates[$key]) {
            throw new NotFoundHttpException();
        }

        $typeClass = $this->getTypeClass($key);
        /** @var AbstractType $type */
        $type = $this->get('form.registry')->getType($typeClass)->getInnerType();
        $this->form = $this->get('form.factory')->create($typeClass);
        $this->form->handleRequest($request);

        if ($this->form->isSubmitted()
            && $this->form->isValid()
            && $response = $this->handleFormOnlySubmit($request, $type)
        ) {
            // success form submit

            return $response;
        }

        return $this->render($ajaxTemplates[$key], ['form' => $this->form->createView()]);
    }
public function onlyAction ( Request $ request , $ key ) { $ ajaxTemplates = $ this -> container -> getParameter ( 'sulu_form.ajax_templates' ) ; if ( ! $ ajaxTemplates [ $ key ] ) { throw new NotFoundHttpException ( ) ; } $ typeClass = $ this -> getTypeClass ( $ key ) ; /** @var AbstractType $type */ $ type = $ this -> get ( 'form.registry' ) -> getType ( $ typeClass ) -> getInnerType ( ) ; $ this -> form = $ this -> get ( 'form.factory' ) -> create ( $ typeClass ) ; $ this -> form -> handleRequest ( $ request ) ; if ( $ this -> form -> isSubmitted ( ) && $ this -> form -> isValid ( ) && $ response = $ this -> handleFormOnlySubmit ( $ request , $ type ) ) { // success form submit return $ response ; } return $ this -> render ( $ ajaxTemplates [ $ key ] , [ 'form' => $ this -> form -> createView ( ) ] ) ; }
Form only action.

@param Request $request
@param string $key

@return RedirectResponse|Response

@throws NotFoundHttpException
Form only action .