Skip to content

Instantly share code, notes, and snippets.

@messyOne
messyOne / Module.php
Created Oct 9, 2012
ZfcUserMod for DluTwBootstrap
View Module.php
<?php
namespace ZfcUserMod;
/**
* Description of Module
*
* @author messy
*/
class Module
{
View Module.php
public function getViewHelperConfig()
{
return array(
'initializers' => array(
function($instance, $viewServiceManager) {
if ($instance instanceof ServiceLocatorAwareInterface) {
$instance->setServiceLocator($viewServiceManager->getServiceLocator());
}
View Module.php
public function onModuleDispatch(\Zend\Mvc\MvcEvent $e)
{
//Set the main menu into the layout view model
$serviceManager = $e->getApplication()->getServiceManager();
$navbarContainer = $serviceManager->get('loo_navigation');
$viewModel = $e->getViewModel();
$viewModel->setVariable('navbar', $navbarContainer);
}
@messyOne
messyOne / Module.php
Created Oct 10, 2012
Insert user_id in user_role_linker
View Module.php
public function onBootstrap($e)
{
$app = $e->getTarget();
$sm = $app->getServiceManager();
$adapter = $sm->get('Zend\Db\Adapter\Adapter');
// adding action for user registration
$zfcServiceEvents = $sm->get('zfcuser_user_service')->getEventManager();
$zfcServiceEvents->attach(