I'm hacking itoggle to trigger my function after itoggle changes a value. I insert my function just after the entity_save line within _itoggle_ajax_toggle_field function. But it would be great to be able to use a hook so I don't have to hack the module.

Comments

robertgarrigos created an issue.

robertgarrigos’s picture

I tried to make a patch with no luck. I just paste the code I would use with a hook:

foreach (module_implements('itoggle_toggle_field') as $module) {
          $function = $module . '_itoggle_toggle_field';
          $function($entity, $field, $value);
        }

I put this code within the function _itoggle_ajax_toggle_field of itoggle.pages.inc file, just after the line

$return = entity_save($type, $entity) !== FALSE;

inside the try block.

Then I implement mymodule_itoggle_toggle_field($entity, $field, $value) function within my module.

Could you add this to the module? Also another hook for _itoggle_ajax_toggle_entity function would be useful.

Thanks.