Problem/Motivation
FAPI ajax callbacks can only be global functions because is_function() is used and these are called in a special way that will only work for global functions.
Proposed resolution
Use is_callable and call_user_func_array() to allow for namespaced callbacks.
Remaining tasks
RTBC
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 2747679-fix-ajax-callbacks-9.patch | 561 bytes | pashupathi nath gajawada |
| #2 | 2747679-fix-ajax-callbacks.patch | 715 bytes | david_garcia |
Comments
Comment #2
david_garcia commentedComment #3
izaaksom commentedStraightforward fix. Thanks!
Comment #4
fabianx commentedNice work, marking for commit.
Comment #5
fabianx commentedProven this works for PHP 4.3 - 7:
https://3v4l.org/smvcH
Comment #6
stefan.r commentedComment #7
David_Rothstein commentedSee comment at #2652814-8: Allow the use of callbacks for element value callbacks and batch API redirect callbacks which applies here too.
Comment #8
fabianx commentedis_callable is fine, but call_user_func_array() needs to be removed per #2652814: Allow the use of callbacks for element value callbacks and batch API redirect callbacks.
Comment #9
pashupathi nath gajawada commentedHi Fabian Franz,
Updated the patch as suggested in #8.
Thanks,
Comment #10
fabianx commentedTo RTBC, thanks for the patch
Comment #11
fabianx commentedLeaving for a moment for others to review, then will commit later, so marking for most-likely commit.
Comment #13
fabianx commentedCommitted and pushed to 7.x! Thanks!
Comment #14
David_Rothstein commentedI took a stab at a change record here, for this issue and #2760609: Allow the use of callbacks instead of global functions in parts of the Form API combined: https://www.drupal.org/node/2761169