Skip to content

Instantly share code, notes, and snippets.

@Colmea
Created March 10, 2015 12:55
Show Gist options
  • Save Colmea/b04cd9f50b6ac6ab1821 to your computer and use it in GitHub Desktop.
Save Colmea/b04cd9f50b6ac6ab1821 to your computer and use it in GitHub Desktop.
Custom View Helper ZF2
use MyModule\View\Helper\MyViewHelper;
class Module
{
[...]
public function getViewHelperConfig()
{
return array(
'factories' => array(
'MyViewHelper' => function($sm) {
$router = $locator->get('Router');
$request = $locator->get('Request')
$myViewHelper = new MyViewHelper($router, $request);
return $myViewHelper;
},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment