Skip to content

Instantly share code, notes, and snippets.

@Remo
Created October 2, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Remo/0a880d78a437f8e725cc to your computer and use it in GitHub Desktop.
Save Remo/0a880d78a437f8e725cc to your computer and use it in GitHub Desktop.
package controller - variable injection
<?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