Created
October 2, 2015 18:19
-
-
Save Remo/0a880d78a437f8e725cc to your computer and use it in GitHub Desktop.
package controller - variable injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Concrete\Package\Test; | |
use Package, | |
Page, | |
Events, | |
View, | |
Symfony\Component\EventDispatcher\GenericEvent; | |
class Controller extends Package | |
{ | |
protected $pkgHandle = 'test'; | |
protected $appVersionRequired = '5.7.5'; | |
protected $pkgVersion = '0.9.1'; | |
public function getPackageName() | |
{ | |
return t('Test'); | |
} | |
public function getPackageDescription() | |
{ | |
return t('Test'); | |
} | |
public function on_start() | |
{ | |
Events::addListener( | |
'on_before_render', function (GenericEvent $e) { | |
$view = $e->getArgument('view'); | |
$view->controller->set('foo', 'bar'); | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment