Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Callbacks: Difference between revisions

From MoodleDocs
No edit summary
mNo edit summary
 
Line 5: Line 5:
: +1 I believe we should call them hooks - same as Drupal does - https://api.drupal.org/api/drupal/core%21core.api.php/group/hooks/9.1.x --[[User:David Mudrak|David Mudrak]] ([[User talk:David Mudrak|talk]]) 18:58, 3 September 2020 (UTC)
: +1 I believe we should call them hooks - same as Drupal does - https://api.drupal.org/api/drupal/core%21core.api.php/group/hooks/9.1.x --[[User:David Mudrak|David Mudrak]] ([[User talk:David Mudrak|talk]]) 18:58, 3 September 2020 (UTC)
: +0.5  For me they are hook[ing] points (a place where custom stuff can be added), and the functions implementing that stuff are the hooks. Really they share a lot with callbacks/promises or events, although for some reason I see the later ones for async or at-distance operations, while hooks are nearer, executed in place and sync. --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] ([[User talk:Eloy Lafuente (stronk7)|talk]]) 21:43, 3 September 2020 (UTC)
: +0.5  For me they are hook[ing] points (a place where custom stuff can be added), and the functions implementing that stuff are the hooks. Really they share a lot with callbacks/promises or events, although for some reason I see the later ones for async or at-distance operations, while hooks are nearer, executed in place and sync. --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] ([[User talk:Eloy Lafuente (stronk7)|talk]]) 21:43, 3 September 2020 (UTC)
:: Yes. Hooks are the places where we give plugins a chance to extend or alter the current execution. These hooks can be implemented by plugins, so the functions are "hooks implementations". --[[User:David Mudrak|David Mudrak]] ([[User talk:David Mudrak|talk]]) 07:34, 21 September 2020 (UTC)

Latest revision as of 07:34, 21 September 2020

Calling these callbacks officially is confusing for any new developer coming into moodle. A callback is a function reference passed as a parameter in a function call. Or from wikipedia "a callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at a given time." This is not what these are. Sure, we can make the argument that these are "moodle" callbacks. But these really are just API methods. As an open source project we have responsibility to the correct terms to refer to parts of our infrastructure to lower the barrier for entry and understanding of our code. --John Okely (talk) 09:00, 22 May 2017 (AWST)

+1 --Tim Hunt (talk) 02:46, 23 May 2017 (AWST)

+1 I believe we should call them hooks - same as Drupal does - https://api.drupal.org/api/drupal/core%21core.api.php/group/hooks/9.1.x --David Mudrak (talk) 18:58, 3 September 2020 (UTC)
+0.5 For me they are hook[ing] points (a place where custom stuff can be added), and the functions implementing that stuff are the hooks. Really they share a lot with callbacks/promises or events, although for some reason I see the later ones for async or at-distance operations, while hooks are nearer, executed in place and sync. --Eloy Lafuente (stronk7) (talk) 21:43, 3 September 2020 (UTC)
Yes. Hooks are the places where we give plugins a chance to extend or alter the current execution. These hooks can be implemented by plugins, so the functions are "hooks implementations". --David Mudrak (talk) 07:34, 21 September 2020 (UTC)