NVM i found out why.

callbacks are disabled in FormHelper (for performance reasons, maybe?)

i added this to MyFormHelper

public function implementedEvents () {
return ['View.afterLayout' => 'afterLayout'];
}

and now my callback is working... but i'm getting this warning:

Warning (4096): Argument 1 passed to 
App\View\Helper\MyFormHelper::afterLayout() must be an instance of 
App\View\Helper\Event, instance of Cake\Event\Event given, called in 
C:\path-to-my-app\vendor\cakephp\cakephp\src\Event\EventManager.php on line 
274 and defined [C:\path-to-my-app\src\View\Helper\MyFormHelper.php, line 
22]

any clue?

Il giorno martedì 27 gennaio 2015 10:06:48 UTC+1, Ernesto ha scritto:
>
> Hi all
>
> i made a custom FormHelper and the callbacks are not working
>
> did i miss something?
>
> here's my code
>
> <?php
>
> namespace App\View\Helper;
>
> use Cake\View\Helper\FormHelper;
>
> class MyFormHelper extends FormHelper
> {
>  public function afterLayout(Event $event, $layoutFile)
> {
> $this->Html->script('jquery', ['block' => true]);
> $this->Html->script('jquery-ui', ['block' => true]);
> $this->Html->css('jquery-ui', null, ['block' => true]);
> parent::afterLayout($event, $layoutFile);
> }
>
> }
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to