public function cleanLayout(ViewEvent $e)
    {
        $result   = $e->getResult();
        $response = $e->getResponse();
        $model = $e->getModel();
        if ($model->hasChildren()) {
            $children = $model->getChildren();
            $content = null;
            foreach ($children as $child) {
                if ($child->captureTo() == 'content') {
                    $content = $child;
                    $this->attachViewResolver();
                }
            }
            if (!empty($content)) {
                $e->setModel($content);
            }
        } else {
            // attach the own resolver here too ?
            // ...
        }
    }
public function cleanLayout(ViewEvent $e)
    {
        $result   = $e->getResult();
        $response = $e->getResponse();
        $model = $e->getModel();
        if ($model->hasChildren()) {
            $children = $model->getChildren();
            $content = null;
            foreach ($children as $child) {
                if ($child->captureTo() == 'content') {
                    $content = $child;
                    $this->attachViewResolver();
                }
            }
            if (!empty($content)) {
                $e->setModel($content);
            }
        } else {
            // attach the own resolver here too ?
            // ...
        }
    }
public function cleanLayout ( ViewEvent $ e ) { $ result = $ e -> getResult ( ) ; $ response = $ e -> getResponse ( ) ; $ model = $ e -> getModel ( ) ; if ( $ model -> hasChildren ( ) ) { $ children = $ model -> getChildren ( ) ; $ content = null ; foreach ( $ children as $ child ) { if ( $ child -> captureTo ( ) == 'content' ) { $ content = $ child ; $ this -> attachViewResolver ( ) ; } } if ( ! empty ( $ content ) ) { $ e -> setModel ( $ content ) ; } } else { // attach the own resolver here too ? // ... } }
remove unwanted or layout related data

basically you rake through the viewmodel for the data you want to use for your template,
this may not be optimal because you have to rely on the correct naming of the viewmodels

if you get the data you want, you switch to the specific template by adding the conforming resolver

@param \Zend\View\ViewEvent $e
remove unwanted or layout related data