0

I've got a plugin that retrieves a list of buttons. When i call this plugin from the view (echo $this->GetAdminButtons()) it works fine. But I need to call this plugin from the layout.phtml and when i do, the application just stops (white screen, no output)

When i try to get the exception message i get this error:

Plugin by name 'GetAdminButtons' was not found in the registry;
used paths: 
    Zend_View_Helper_Navigation_: Zend/View/Helper/Navigation/ 
    Zend_View_Helper_:            Zend/View/Helper/:./views/helpers/

In the application.ini

resources.view.helperPath.Admin_View_Helper = "Admin/View/Helper"

Which confuses me because it works fine in the view .phtml files

Thanks in advance,

Sephen
  • 1,111
  • 3
  • 16
  • 38
  • Where is the helper located? `views/helpers/GetAdminButtons.php`? – Tim Fountain Jul 28 '12 at 11:52
  • Its located in the library/Admin/View/Helper/GetAdminButtons.php And this directory is set as a helper path in the application.ini. – Sephen Jul 28 '12 at 12:22
  • That path is not included in the path list in the error. Could you edit your question to include the relevant part of your application.ini where you set the helper paths? – Tim Fountain Jul 28 '12 at 12:26
  • Do you by any chance have some lines in your config that start `resources.layout`? If so, does it work if you move them above the view lines? – Tim Fountain Jul 28 '12 at 21:33
  • The layout lines were already above the view lines. I've also tried to place the file in every known views/helpers folder still no luck. Any ideas? – Sephen Jul 29 '12 at 08:22

1 Answers1

0

Continuing the discussion from the comments. Try moving the resources.layout lines in your config so they are after the resources.view ones (my suggestion in the comment had things the wrong way round).

I think your issue is that the layout is being initialized before the view is, which is why the view paths don't exist in the layout.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
  • I did switch the lines both ways to see if it made any difference but it didn't. – Sephen Jul 29 '12 at 09:20
  • Do you have any _init methods in your bootstrap class? – Tim Fountain Jul 29 '12 at 09:21
  • Yes i got a few, also protected function _initViewHelpers() { $this->bootstrap('layout'); $view = $this->getResource('layout')->getView(); } – Sephen Jul 29 '12 at 09:38
  • Ok, any called `_initLayout()` or `_initView()`? – Tim Fountain Jul 29 '12 at 09:39
  • This is the same problem, just in a different place. Try changing the bootstrap line in that `_initViewHelpers()` to `$this->bootstrap(array('view', 'layout'));` That forces it to bootstrap the view first. – Tim Fountain Jul 29 '12 at 09:42
  • That did the trick! ($this->bootstrap(array('view', 'layout'));) the plugin is being called! You Rock! thanks a lot! – Sephen Jul 29 '12 at 10:39