code: public function onRenderSpecLayout(MvcEvent $e)
      {
          $r = $e->getResult();
          if (! $r instanceof ViewModel || $r->terminate())
              return;
  
          $model = $e->getViewModel();
  
          $themeLocator  = $this->getThemeLocator();
  
          // we want theme path stack registered before
          #$this->onRenderAddPathStacks($e);
  
          // get Layout from Locator
          $mvcLayout = $themeLocator->getMvcLayout($e);
          if ($mvcLayout) {
              // we want same on theme layout name if not set
              $model->setTemplate($mvcLayout);
          }
      }
docs: Change layout
  
  @param MvcEvent $e