Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

UnauthorizedStrategy does not render templates #290

Open
thestanislav opened this issue Apr 7, 2015 · 2 comments
Open

UnauthorizedStrategy does not render templates #290

thestanislav opened this issue Apr 7, 2015 · 2 comments
Assignees
Labels

Comments

@thestanislav
Copy link

  1. In UnauthorizedStrategy templates are never rendered, because view model is overridden later by InjectViewModelListener. See https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/InjectViewModelListener.php
    We should attach listener with less priority than -100
  2. We should add model as child of layout model. See how things are done here:
    https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/InjectViewModelListener.php#L47
    The code should look somehow like this:
....
$model = new ViewModel();
$model->setTemplate($this->getTemplate());
if ($event->getError() && $event->getViewModel() instanceof ClearableModelInterface) {
     $event->getViewModel() ->clearChildren();
}
$event->getViewModel()->addChild($model);
....
@atukai
Copy link
Contributor

atukai commented Apr 22, 2015

Have the same problem

@danizord danizord added the bug label Sep 9, 2015
@danizord danizord self-assigned this Sep 9, 2015
@danizord
Copy link
Member

danizord commented Sep 9, 2015

@thestanislav can you provide a PR? Tell me if I can help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants