diff options
| author | 2025-09-30 16:59:41 -0400 | |
|---|---|---|
| committer | 2025-09-30 22:59:41 +0200 | |
| commit | 72884813e13596d211471482ffdc6d723ed678c9 (patch) | |
| tree | 043856f23bdcae7f9f88294c47c499657c2d05ff /docs | |
| parent | bf6e634e042b726edd97335ac36b2305f8101b3f (diff) | |
Add hook enums (#8036)
- add an enum to handle hook types (enum are available since PHP 8.1)
- change hook calls from string value to enum value
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/en/developers/03_Backend/05_Extensions.md | 6 | ||||
| -rw-r--r-- | docs/fr/developers/03_Backend/05_Extensions.md | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md index fcae42b5a..189e5d64f 100644 --- a/docs/en/developers/03_Backend/05_Extensions.md +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -143,8 +143,8 @@ final class HelloWorldExtension extends Minz_Extension public function init(): void { parent::init(); - $this->registerHook('entry_before_display', [$this, 'renderEntry']); - $this->registerHook('check_url_before_add', [self::class, 'checkUrl']); + $this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry']); + $this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl']); } public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry { @@ -164,7 +164,7 @@ final class HelloWorldExtension extends Minz_Extension The following events are available: -* `api_misc` (`function(): void`): to allow extensions to have own API endpoint +* `api_misc` (`function(): void`): to allow extensions to have their own API endpoint on `/api/misc.php/Extension%20Name/` or `/api/misc.php?ext=Extension%20Name`. * `before_login_btn` (`function(): string`): Allows to insert HTML before the login button. Applies to the create button on the register page as well. Example use case is inserting a captcha widget. * `check_url_before_add` (`function($url) -> Url | null`): will be executed every time a URL is added. The URL itself will be passed as parameter. This way a website known to have feeds which doesn’t advertise it in the header can still be automatically supported. diff --git a/docs/fr/developers/03_Backend/05_Extensions.md b/docs/fr/developers/03_Backend/05_Extensions.md index 18cc892be..00a229e94 100644 --- a/docs/fr/developers/03_Backend/05_Extensions.md +++ b/docs/fr/developers/03_Backend/05_Extensions.md @@ -197,8 +197,8 @@ final class HelloWorldExtension extends Minz_Extension public function init(): void { parent::init(); - $this->registerHook('entry_before_display', [$this, 'renderEntry']); - $this->registerHook('check_url_before_add', [self::class, 'checkUrl']); + $this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry']); + $this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl']); } public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry { |
