aboutsummaryrefslogtreecommitdiff
path: root/docs/en/developers/03_Backend/05_Extensions.md
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2025-10-01 05:01:31 -0400
committerGravatar GitHub <noreply@github.com> 2025-10-01 11:01:31 +0200
commitdac275ce3a3529494af1b86b803f140a1a55424e (patch)
tree2876f52e8575cb19de238c32b076e54375555efd /docs/en/developers/03_Backend/05_Extensions.md
parent2bcc090622c0e62dbff94e52bb6892a51b40ba2a (diff)
Add support for extension priority (#8038)
Extension can now define their hook priority. This will allow to define the order in which hooks are triggered. See #7110 Closes #7110 Changes proposed in this pull request: - Add support for extension priority How to test the feature manually: 1. Create an extension with 2 hooks on the same hook type but different priority 2. The hooks must be prepending the title with different values 3. Validate that changing the hook priority changes the final title accordingly.
Diffstat (limited to 'docs/en/developers/03_Backend/05_Extensions.md')
-rw-r--r--docs/en/developers/03_Backend/05_Extensions.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md
index 189e5d64f..cfdb4e692 100644
--- a/docs/en/developers/03_Backend/05_Extensions.md
+++ b/docs/en/developers/03_Backend/05_Extensions.md
@@ -135,6 +135,9 @@ The `Minz_Extension` abstract class defines another set of methods that should n
### The "hooks" system
You can register at the FreshRSS event system in an extensions `init()` method, to manipulate data when some of the core functions are executed.
+The last parameter is the priority of the hook when triggered.
+The hook with the lowest priority value are triggered first.
+The default priority is 0.
```php
final class HelloWorldExtension extends Minz_Extension
@@ -143,8 +146,8 @@ final class HelloWorldExtension extends Minz_Extension
public function init(): void {
parent::init();
- $this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry']);
- $this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl']);
+ $this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry'], 10);
+ $this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl'], -10);
}
public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry {