public function buildView($game)
    {
        if ($this->getRequest()->isXmlHttpRequest()) {
            $viewModel = new JsonModel();
            if ($game) {
                $view = $this->addAdditionalView($game);
                if ($view && $view instanceof \Zend\View\Model\ViewModel) {
                    $viewModel->setVariables($view->getVariables());
                }
            }
        } else {
            $viewModel = new ViewModel();

            if ($game) {
                $this->addMetaTitle($game);
                //$this->addMetaBitly();
                $this->addGaEvent($game);

                $this->customizeGameDesign($game);

                $view = $this->addAdditionalView($game);
                if ($view && $view instanceof \Zend\View\Model\ViewModel) {
                    $viewModel->addChild($view, 'additional');
                } elseif ($view && $view instanceof \Zend\Http\PhpEnvironment\Response) {
                    return $view;
                }

                $this->layout()->setVariables(
                    array(
                        'action'        => $this->params('action'),
                        'game'          => $game,
                        'flashMessages' => $this->flashMessenger()->getMessages(),
                    )
                );

                $viewModel->setVariables($this->getShareData($game));
                $viewModel->setVariables(
                    array(
                        'game' => $game,
                        'user' => $this->user
                    )
                );
            }
        }

        return $viewModel;
    }
public function buildView($game)
    {
        if ($this->getRequest()->isXmlHttpRequest()) {
            $viewModel = new JsonModel();
            if ($game) {
                $view = $this->addAdditionalView($game);
                if ($view && $view instanceof \Zend\View\Model\ViewModel) {
                    $viewModel->setVariables($view->getVariables());
                }
            }
        } else {
            $viewModel = new ViewModel();

            if ($game) {
                $this->addMetaTitle($game);
                //$this->addMetaBitly();
                $this->addGaEvent($game);

                $this->customizeGameDesign($game);

                $view = $this->addAdditionalView($game);
                if ($view && $view instanceof \Zend\View\Model\ViewModel) {
                    $viewModel->addChild($view, 'additional');
                } elseif ($view && $view instanceof \Zend\Http\PhpEnvironment\Response) {
                    return $view;
                }

                $this->layout()->setVariables(
                    array(
                        'action'        => $this->params('action'),
                        'game'          => $game,
                        'flashMessages' => $this->flashMessenger()->getMessages(),
                    )
                );

                $viewModel->setVariables($this->getShareData($game));
                $viewModel->setVariables(
                    array(
                        'game' => $game,
                        'user' => $this->user
                    )
                );
            }
        }

        return $viewModel;
    }
public function buildView ( $ game ) { if ( $ this -> getRequest ( ) -> isXmlHttpRequest ( ) ) { $ viewModel = new JsonModel ( ) ; if ( $ game ) { $ view = $ this -> addAdditionalView ( $ game ) ; if ( $ view && $ view instanceof \ Zend \ View \ Model \ ViewModel ) { $ viewModel -> setVariables ( $ view -> getVariables ( ) ) ; } } } else { $ viewModel = new ViewModel ( ) ; if ( $ game ) { $ this -> addMetaTitle ( $ game ) ; //$this->addMetaBitly(); $ this -> addGaEvent ( $ game ) ; $ this -> customizeGameDesign ( $ game ) ; $ view = $ this -> addAdditionalView ( $ game ) ; if ( $ view && $ view instanceof \ Zend \ View \ Model \ ViewModel ) { $ viewModel -> addChild ( $ view , 'additional' ) ; } elseif ( $ view && $ view instanceof \ Zend \ Http \ PhpEnvironment \ Response ) { return $ view ; } $ this -> layout ( ) -> setVariables ( array ( 'action' => $ this -> params ( 'action' ) , 'game' => $ game , 'flashMessages' => $ this -> flashMessenger ( ) -> getMessages ( ) , ) ) ; $ viewModel -> setVariables ( $ this -> getShareData ( $ game ) ) ; $ viewModel -> setVariables ( array ( 'game' => $ game , 'user' => $ this -> user ) ) ; } } return $ viewModel ; }
This method create the basic Game view
@param \PlaygroundGame\Entity\Game $game
This method create the basic Game view