From 2aed707f89cef81b2d29d58e14ef2d8654ddd080 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 28 Oct 2025 12:03:21 +0800 Subject: [PATCH] [docs] hooks: Clarify the execution order and priorities. --- docs/apis/core/hooks/index.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/apis/core/hooks/index.md b/docs/apis/core/hooks/index.md index 5ba19e46e..ad058b7cd 100644 --- a/docs/apis/core/hooks/index.md +++ b/docs/apis/core/hooks/index.md @@ -291,8 +291,15 @@ Support for Array notated callbacks was introduced in Moodle 4.4. If you are wri ::: -Hook callbacks are executed in the order of their priority from highest to lowest. -Any guidelines for callback priority should be described in hook descriptions if necessary. +### Hook Callback Execution Order + +Hook callbacks are executed according to their priority, in **descending order** — from the **highest number** to the **lowest**. + +- **Default priority:** `100` +- **Higher numbers:** executed **earlier** +- **Lower numbers (down to 0):** executed **later** + +If a particular hook requires callbacks to run in a specific order, its documentation should include guidelines on what priorities to use. :::caution