public function setViewTemplates(PreContentViewEvent $event)
    {
        $view = $event->getContentView();

        foreach ($this->viewTemplates as $viewClass => $template) {
            if ($view instanceof $viewClass) {
                $view->setTemplateIdentifier($template);
                $view->addParameters(['pagelayout' => $this->pagelayout]);
            }
        }
    }
public function setViewTemplates(PreContentViewEvent $event)
    {
        $view = $event->getContentView();

        foreach ($this->viewTemplates as $viewClass => $template) {
            if ($view instanceof $viewClass) {
                $view->setTemplateIdentifier($template);
                $view->addParameters(['pagelayout' => $this->pagelayout]);
            }
        }
    }
public function setViewTemplates ( PreContentViewEvent $ event ) { $ view = $ event -> getContentView ( ) ; foreach ( $ this -> viewTemplates as $ viewClass => $ template ) { if ( $ view instanceof $ viewClass ) { $ view -> setTemplateIdentifier ( $ template ) ; $ view -> addParameters ( [ 'pagelayout' => $ this -> pagelayout ] ) ; } } }
If the event's view has a defined template, sets the view's template identifier,
and the 'pagelayout' parameter.

@param PreContentViewEvent $event
If the event s view has a defined template sets the view s template identifier and the pagelayout parameter .