Re: Events - how do I attach additional callbacks to the HelperCollection

2012-09-08 Thread Greg Skerman
Ahh thanks for the example.. got it all working now :)


On Sat, Sep 8, 2012 at 3:09 PM, rchavik  wrote:

>
> On Friday, September 7, 2012 10:23:06 PM UTC+7, Greg wrote:
>>
>> Hi,
>>
>> I've got a case where I want one helper to raise events on other helpers.
>> The concept is that plugins can manipulate the output of a MenuHelper by
>> returning additional menu items at runtime.
>>
>> Is there a way that I can access an instance of the helper collection and
>> attach additional callbacks that can be listed to? sorry no code samples at
>> the moment, I'm a little bit lost on the way this is implemented, just need
>> a nudge in the right direction.
>>
>
> There's something similar in Croogo:
>
> Trigger events:
> https://github.com/croogo/croogo/blob/1.5/View/Helper/LayoutHelper.php#L313
>
> Setup another helper to listen for that event:
>
> https://github.com/croogo/croogo/blob/1.5/Plugin/Menus/View/Helper/MenusHelper.php#L32
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Events - how do I attach additional callbacks to the HelperCollection

2012-09-07 Thread rchavik

On Friday, September 7, 2012 10:23:06 PM UTC+7, Greg wrote:
>
> Hi,
>
> I've got a case where I want one helper to raise events on other helpers. 
> The concept is that plugins can manipulate the output of a MenuHelper by 
> returning additional menu items at runtime.
>
> Is there a way that I can access an instance of the helper collection and 
> attach additional callbacks that can be listed to? sorry no code samples at 
> the moment, I'm a little bit lost on the way this is implemented, just need 
> a nudge in the right direction.
>

There's something similar in Croogo:

Trigger events:
https://github.com/croogo/croogo/blob/1.5/View/Helper/LayoutHelper.php#L313

Setup another helper to listen for that event:
https://github.com/croogo/croogo/blob/1.5/Plugin/Menus/View/Helper/MenusHelper.php#L32

 

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.