frontend/controllers/UserController.php
/**
     * Renders Contact us page. Handles contact form submition.
     * Displays Site ContactUs page.
     * @return mixed
     */
Renders Contact us page. Handles contact form submition.
Displays Site ContactUs page.
@return mixed
Renders Contact us page . Handles contact form submition . Displays Site ContactUs page . @return mixed
public function actionContact()
    {
        $title = $this->pages->getPageTitle($this->param);
        $meta =$this->pages->getPageMetaData($this->param);
        $contactForm = new ContactForm();
        if (Yii::$app->request->isPost) {
            $post = Yii::$app->request->post();
            $post['reCaptchaResp'] = Yii::$app->request->post('g-recaptcha-response', null);
            $contactForm->load($post, '');
            if ($contactForm->send()) {
                try {
                    $this->contact_us_messages->createNewSupportMessage(Yii::$app->request->post());
                } catch (RuntimeException $e) {
                    throw new RuntimeException("Support Messages not saved");
                }
                \Yii::$app->session->setFlash('consol_v_error',\Yii::t('app/consol', 'Contact Form successfully submitted,Thank you,i will get back to you soon!'));
                $contactForm = new ContactForm();
            }
        }
        return $this->render('contact', ['contactForm' => $contactForm,'meta'=>$meta,'title'=>$title]);
    }
public function actionContact ( ) { $ title = $ this -> pages -> getPageTitle ( $ this -> param ) ; $ meta = $ this -> pages -> getPageMetaData ( $ this -> param ) ; $ contactForm = new ContactForm ( ) ; if ( Yii :: $ app -> request -> isPost ) { $ post = Yii :: $ app -> request -> post ( ) ; $ post [ 'reCaptchaResp' ] = Yii :: $ app -> request -> post ( 'g-recaptcha-response' , null ) ; $ contactForm -> load ( $ post , '' ) ; if ( $ contactForm -> send ( ) ) { try { $ this -> contact_us_messages -> createNewSupportMessage ( Yii :: $ app -> request -> post ( ) ) ; } catch ( RuntimeException $ e ) { throw new RuntimeException ( " Support Messages not saved " ) ; } \ Yii :: $ app -> session -> setFlash ( 'consol_v_error' , \ Yii :: t ( 'app/consol' , 'Contact Form successfully submitted,Thank you,i will get back to you soon!' ) ) ; $ contactForm = new ContactForm ( ) ; } } return $ this -> render ( 'contact' , [ 'contactForm' => $ contactForm , 'meta' => $ meta , 'title' => $ title ] ) ; }
Renders Contact us page.
Renders Contact us page .