public function showFeedbackFormAction(Request $request, ContentView $view)
    {
        // Creating a form using Symfony's form component
        $feedback = new Feedback();
        $form = $this->createForm($this->get('ezdemo.form.type.feedback'), $feedback);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);

            if ($form->isValid()) {
                /** @var EmailHelper $emailHelper */
                $emailHelper = $this->get('ezdemo.email_helper');
                $emailHelper->sendFeebackMessage(
                    $feedback,
                    $this->container->getParameter('ezdemo.feedback_form.email_from'),
                    $this->container->getParameter('ezdemo.feedback_form.email_to')
                );

                // Adding the confirmation flash message to the session
                $this->get('session')->getFlashBag()->add(
                    'notice',
                    $this->get('translator')->trans('Thank you for your message, we will get back to you as soon as possible.')
                );

                return $this->redirect($this->generateUrl($view->getLocation()));
            }
        }

        $view->addParameters(['form' => $form->createView()]);

        return $view;
    }
public function showFeedbackFormAction(Request $request, ContentView $view)
    {
        // Creating a form using Symfony's form component
        $feedback = new Feedback();
        $form = $this->createForm($this->get('ezdemo.form.type.feedback'), $feedback);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);

            if ($form->isValid()) {
                /** @var EmailHelper $emailHelper */
                $emailHelper = $this->get('ezdemo.email_helper');
                $emailHelper->sendFeebackMessage(
                    $feedback,
                    $this->container->getParameter('ezdemo.feedback_form.email_from'),
                    $this->container->getParameter('ezdemo.feedback_form.email_to')
                );

                // Adding the confirmation flash message to the session
                $this->get('session')->getFlashBag()->add(
                    'notice',
                    $this->get('translator')->trans('Thank you for your message, we will get back to you as soon as possible.')
                );

                return $this->redirect($this->generateUrl($view->getLocation()));
            }
        }

        $view->addParameters(['form' => $form->createView()]);

        return $view;
    }
public function showFeedbackFormAction ( Request $ request , ContentView $ view ) { // Creating a form using Symfony's form component $ feedback = new Feedback ( ) ; $ form = $ this -> createForm ( $ this -> get ( 'ezdemo.form.type.feedback' ) , $ feedback ) ; if ( $ request -> isMethod ( 'POST' ) ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { /** @var EmailHelper $emailHelper */ $ emailHelper = $ this -> get ( 'ezdemo.email_helper' ) ; $ emailHelper -> sendFeebackMessage ( $ feedback , $ this -> container -> getParameter ( 'ezdemo.feedback_form.email_from' ) , $ this -> container -> getParameter ( 'ezdemo.feedback_form.email_to' ) ) ; // Adding the confirmation flash message to the session $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'notice' , $ this -> get ( 'translator' ) -> trans ( 'Thank you for your message, we will get back to you as soon as possible.' ) ) ; return $ this -> redirect ( $ this -> generateUrl ( $ view -> getLocation ( ) ) ) ; } } $ view -> addParameters ( [ 'form' => $ form -> createView ( ) ] ) ; return $ view ; }
Displays the feedback form, and processes posted data.
The signature of this method follows the one from the default view controller, and adds the Request, since
we use to handle form data.

@param \Symfony\Component\HttpFoundation\Request $request
@param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view

@return View
Displays the feedback form and processes posted data . The signature of this method follows the one from the default view controller and adds the Request since we use to handle form data .