If you want to register custom view helpers with a module you can do so by using the service location built into the Skeleton Application and creating a module config that looks something like.
return array(
'view_helpers' => array(
'invokables' => array(
// generic view helpers
'truncate' => 'Zucchi\View\Helper\Truncate',
// form based view helpers
'bootstrapForm' => 'Zucchi\Form\View\Helper\BootstrapForm',
'bootstrapRow' => 'Zucchi\Form\View\Helper\BootstrapRow',
'bootstrapCollection' => 'Zucchi\Form\View\Helper\BootstrapCollection',
),
),
);
Like this:
Like Loading...
Related
Published by Matt Cockayne
Matt is the currently working as a Senior Linux Sysadmin for the Medicines Discovery Catapult and also and Scout Leader.
Having tried his hand a few different careers he finds that he is happiest working with code. As a framework contributor and serial tinkerer Matt has spent a long time working on being the best Software Engineer he can be.
As a Scout Leader he spends a lot of his time devoted to teaching valuable life skills to kids aged 7-18. He is a firm believer that being a Good Scout and Great Developer go hand in hand.
View all posts by Matt Cockayne
Another way would be to define:
public function getViewHelperConfig () { return array(…); }
in your Module.php (per module)
🙂
Most definitely. The nice way with ZF2 is that there is more than one way to skin a cat