Zend\Mvc\View\Http\ViewManager::getViewModel PHP Method

getViewModel() public method

Configures the MvcEvent view model to ensure it has the template injected
public getViewModel ( ) : Zend\View\Model\ModelInterface
return Zend\View\Model\ModelInterface
    public function getViewModel()
    {
        if ($this->viewModel) {
            return $this->viewModel;
        }
        $this->viewModel = $model = $this->event->getViewModel();
        $layoutTemplate = $this->services->get('HttpDefaultRenderingStrategy')->getLayoutTemplate();
        $model->setTemplate($layoutTemplate);
        return $this->viewModel;
    }