On Mon, Dec 17, 2012 at 4:28 AM, fwahlqvist <[email protected]> wrote:
> Thanks Marco,
> Do you know any other module that does this? would be great to see examples
> as i am unsure on how to do this
I can't think of a module off-hand, but I'm sure I've done it before myself.
Basically, you have both service manager configuration, and view
helper configuration. Let's assume that the Markdown class is
invokable; as such, its configuration looks like this:
'service_manager' => array
'invokables' => array(
'Markdown' => ''Some\Markdown\Class',
),
)
The view helper then requires a factory. That factory would look
something like this:
function ($helpers) {
$services = $helpers->getServiceLocator();
return new MarkdownHelper($services->get('Markdown'));
}
And that's all there is to it.
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]