src/ScContent/Listener/Theme/AbstractThemeStrategy.php
protected function injectLayoutTemplate(MvcEvent $event)
    {
        $model = $event->getResult();

        if (! $model instanceof ViewModel) {
            return $this;
        }
        if ($model->terminate()) {
            return $this;
        }

        $viewManager  = $this->getViewManager();
        $renderer     = $viewManager->getRenderer();

        $themeName    = $this->getThemeName();
        $themeOptions = $this->getThemeOptions();

        $options = [];
        if (isset($themeOptions[static::$side])) {
            $options = $themeOptions[static::$side];
        }

        if (isset($options['layouts'])) {
            $layoutsPath = rtrim($options['layouts'], '/') . '/';
        } else {
            $layoutsPath = str_replace(
                ['{theme}', '{side}'],
                [$themeName, static::$side],
                self::DefaultLayoutsPath
            );
        }

        $layout = $event->getViewModel();
        if ($layout && 'layout/layout' !== $layout->getTemplate()) {
            $layout->setTemplate(
                str_replace('{layouts}', $layoutsPath, $layout->getTemplate())
            );
            return $this;
        }

        $defaultLayout = self::DefaultLayout;
        if(isset($options['default_layout'])) {
            $defaultLayout = $options['default_layout'];
        }
        $renderer->layout()->setTemplate($layoutsPath . $defaultLayout);

        return $this;
    }
protected function injectLayoutTemplate(MvcEvent $event)
    {
        $model = $event->getResult();

        if (! $model instanceof ViewModel) {
            return $this;
        }
        if ($model->terminate()) {
            return $this;
        }

        $viewManager  = $this->getViewManager();
        $renderer     = $viewManager->getRenderer();

        $themeName    = $this->getThemeName();
        $themeOptions = $this->getThemeOptions();

        $options = [];
        if (isset($themeOptions[static::$side])) {
            $options = $themeOptions[static::$side];
        }

        if (isset($options['layouts'])) {
            $layoutsPath = rtrim($options['layouts'], '/') . '/';
        } else {
            $layoutsPath = str_replace(
                ['{theme}', '{side}'],
                [$themeName, static::$side],
                self::DefaultLayoutsPath
            );
        }

        $layout = $event->getViewModel();
        if ($layout && 'layout/layout' !== $layout->getTemplate()) {
            $layout->setTemplate(
                str_replace('{layouts}', $layoutsPath, $layout->getTemplate())
            );
            return $this;
        }

        $defaultLayout = self::DefaultLayout;
        if(isset($options['default_layout'])) {
            $defaultLayout = $options['default_layout'];
        }
        $renderer->layout()->setTemplate($layoutsPath . $defaultLayout);

        return $this;
    }
protected function injectLayoutTemplate ( MvcEvent $ event ) { $ model = $ event -> getResult ( ) ; if ( ! $ model instanceof ViewModel ) { return $ this ; } if ( $ model -> terminate ( ) ) { return $ this ; } $ viewManager = $ this -> getViewManager ( ) ; $ renderer = $ viewManager -> getRenderer ( ) ; $ themeName = $ this -> getThemeName ( ) ; $ themeOptions = $ this -> getThemeOptions ( ) ; $ options = [ ] ; if ( isset ( $ themeOptions [ static :: $ side ] ) ) { $ options = $ themeOptions [ static :: $ side ] ; } if ( isset ( $ options [ 'layouts' ] ) ) { $ layoutsPath = rtrim ( $ options [ 'layouts' ] , '/' ) . '/' ; } else { $ layoutsPath = str_replace ( [ '{theme}' , '{side}' ] , [ $ themeName , static :: $ side ] , self :: DefaultLayoutsPath ) ; } $ layout = $ event -> getViewModel ( ) ; if ( $ layout && 'layout/layout' !== $ layout -> getTemplate ( ) ) { $ layout -> setTemplate ( str_replace ( '{layouts}' , $ layoutsPath , $ layout -> getTemplate ( ) ) ) ; return $ this ; } $ defaultLayout = self :: DefaultLayout ; if ( isset ( $ options [ 'default_layout' ] ) ) { $ defaultLayout = $ options [ 'default_layout' ] ; } $ renderer -> layout ( ) -> setTemplate ( $ layoutsPath . $ defaultLayout ) ; return $ this ; }
Inject a template into the layout view model, if none present

@param  \Zend\Mvc\MvcEvent
@return AbstractThemeStrategy
Inject a template into the layout view model if none present