<?php
/**
* Perforce Swarm
*
* @copyright 2012 Perforce Software. All rights reserved.
* @license Please see LICENSE.txt in top-level folder of this distribution.
* @version <release>/<patch>
*/
namespace Frontpage;
use Zend\Mvc\MvcEvent;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;
class Module
{
public function onBootstrap(MvcEvent $event)
{
$application = $event->getParam('application');
$application->getEventManager()->attach('dispatch', array($this, 'setTemplate'), -100);
}
public function setTemplate($event)
{
$matches = $event->getRouteMatch();
$route = $matches->getMatchedRouteName();
// only override user index controller "home" route
if (0 !== strpos($route, 'home', 0)) {
return;
}
$viewModel = $event->getViewModel();
$children = $viewModel->getChildren();
$viewModel->clearChildren();
foreach ($children as $child) {
if ($child->getTemplate() == 'users/index/index') {
$child->setTemplate('frontpage/index/index');
}
$viewModel->addChild($child);
}
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}
# |
Change |
User |
Description |
Committed |
|
#1
|
24084 |
simonrenger |
"Forking branch Main of perforce-software-workshop to simonrenger-workshop." |
|
|
//guest/perforce_software/workshop/main/frontpage/module/Frontpage/Module.php |
#1
|
15568 |
Matt Attaway |
Move all of the workshop files into main branch to make Workshop happy |
|
|
//guest/perforce_software/workshop/frontpage/module/Frontpage/Module.php |
#1
|
10190 |
Matt Attaway |
Publish the Workshop FrontPage module for others to use. |
|
|