And I got it, if anyone needs it later:

    public function getViewHelperConfig()
    {
        return array(
            'factories' => array(
                'navigation' => function(HelperPluginManager $pm) {
                    $helper = new \Zend\View\Helper\Navigation;

                    $pm->injectRenderer($helper);

                    $helper->setServiceLocator($pm->getServiceLocator());
                    
$helper->getPluginManager()->setInvokableClass('menuBootstrap', 
'Application\View\Helper\Navigation\MenuBootstrap');

                    return $helper;
                 }
             )
         );
    }

The new helper needed the renderer injected. Jurians suggested to use an 
initializer, but thats black magic at the moment.

Greetings :)


-----Ursprüngliche Nachricht-----
Von: Marc Tempelmeier 
Gesendet: Dienstag, 18. September 2012 11:48
An: '[email protected]'
Betreff: AW: Replacing the menu helper with custom helper for twitters 
bootstrap menues

Ok,

I narrowed it down further, in the HelperPluginManager in method 
injectRenderer() I have no renderer, line 123 returns null. 

My own menu class is just:
class Menubootstrap extends Menu
{
}

any suggestions? :)

Greetings

Marc

-----Ursprüngliche Nachricht-----
Von: Marc Tempelmeier 
Gesendet: Montag, 17. September 2012 16:08
An: '[email protected]'
Betreff: Replacing the menu helper with custom helper for twitters bootstrap 
menues

Hi,

just another Navigation question :)

I want to replace the menu helper of \Zend\View\Helper\Navigation with my own 
implementation which outputs me the correct html for 
twitters bootstrap menus.

I narrowed it down to:

    public function getViewHelperConfig()
    {
         return array(
             'factories' => array(
                 'navigation' => function(HelperPluginManager $pm) {
                    $helper = new \Zend\View\Helper\Navigation;

                    $pluginManager = new 
\Zend\View\Helper\Navigation\PluginManager();
                    $pluginManager->setInvokableClass('menu', 
'Zend\View\Helper\Navigation\Menubootstrap');

                    $helper->setServiceLocator($pm->getServiceLocator());
                    $helper->setPluginManager($pluginManager);

                    return $helper;
                 }
             )
         );
    }

It works as intented if I set the key for 'menu' direct in 
\Zend\View\Helper\Navigation\PluginManager(), but not if I set it with the 
factory above.
I´ll always get:

Fatal error: Call to a member function plugin() on a non-object in D:\Zend 
Server\Apache2\htdocs\komplex\vendor\Zend2\View\Helper\AbstractHtmlElement.php 
on line 74

I know that the class doesn´t belong in that folder, its there to eliminate the 
possibility of path errors and will go to the correct path after that. :)

Greetings and thx in advance

Marc aka G0re



--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to