public function selectLayoutBasedOnRoute(MvcEvent $e)
    {
        /** @var \Zend\Mvc\Application $app */
        $app    = $e->getParam('application');
        $sm     = $app->getServiceManager();
        $config = $sm->get('config');

        if (false === $config['zfcadmin']['use_admin_layout']) {
            return;
        }

        $match      = $e->getRouteMatch();
        $controller = $e->getTarget();
        if (!($match instanceof V2RouteMatch || $match instanceof V3RouteMatch)
            || 0 !== strpos($match->getMatchedRouteName(), 'zfcadmin')
            || $controller->getEvent()->getResult()->terminate()
        ) {
            return;
        }

        $layout     = $config['zfcadmin']['admin_layout_template'];
        $controller->layout($layout);
    }
public function selectLayoutBasedOnRoute(MvcEvent $e)
    {
        /** @var \Zend\Mvc\Application $app */
        $app    = $e->getParam('application');
        $sm     = $app->getServiceManager();
        $config = $sm->get('config');

        if (false === $config['zfcadmin']['use_admin_layout']) {
            return;
        }

        $match      = $e->getRouteMatch();
        $controller = $e->getTarget();
        if (!($match instanceof V2RouteMatch || $match instanceof V3RouteMatch)
            || 0 !== strpos($match->getMatchedRouteName(), 'zfcadmin')
            || $controller->getEvent()->getResult()->terminate()
        ) {
            return;
        }

        $layout     = $config['zfcadmin']['admin_layout_template'];
        $controller->layout($layout);
    }
public function selectLayoutBasedOnRoute ( MvcEvent $ e ) { /** @var \Zend\Mvc\Application $app */ $ app = $ e -> getParam ( 'application' ) ; $ sm = $ app -> getServiceManager ( ) ; $ config = $ sm -> get ( 'config' ) ; if ( false === $ config [ 'zfcadmin' ] [ 'use_admin_layout' ] ) { return ; } $ match = $ e -> getRouteMatch ( ) ; $ controller = $ e -> getTarget ( ) ; if ( ! ( $ match instanceof V2RouteMatch || $ match instanceof V3RouteMatch ) || 0 !== strpos ( $ match -> getMatchedRouteName ( ) , 'zfcadmin' ) || $ controller -> getEvent ( ) -> getResult ( ) -> terminate ( ) ) { return ; } $ layout = $ config [ 'zfcadmin' ] [ 'admin_layout_template' ] ; $ controller -> layout ( $ layout ) ; }
Select the admin layout based on route name

@param  MvcEvent $e
@return void
Select the admin layout based on route name