Fetch model from event parameter

The model used for rendering can be modified during the
EVENT_RENDERER and EVENT_RENDERER events. If only attributes
(like the template) are modified, the current behaviour does
not raise problems. However, when the entire view model is
swapped out, the current behaviour raises problems.

A use case for swapping out view models is the principle of a
three step view pattern. The <html>, <head> and contents of the
<head> is usually the same for every layout you use. If you
want to abstract that contents into a "wrapper" layout, you
create a new view model, grab the model from the event and use
the model from the event as a child. In code:

```
$model = $e->getModel();
$model->setCaptureTo('foo');

$wrapper = new ViewModel;
$wrapper->setTemplate('layout/bar');
$wrapper->addChild($model);

$e->setModel($wrapper);
```
Create test to ensure view model is retrieved from event
Merge branch 'hotfix/4161'

Close #4161
Merge pull request #4164 from juriansluiman/hotfix/view-model-event

Fetch model from event parameter
Merge branch 'hotfix/4164' into develop

Forward port #4164