mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-02-05 19:11:06 -05:00
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.
21 lines
341 B
PHP
21 lines
341 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
class Minz_Hook {
|
|
public const DEFAULT_PRIORITY = 0;
|
|
|
|
public function __construct(
|
|
private readonly \Closure $function,
|
|
private readonly int $priority,
|
|
) {
|
|
}
|
|
|
|
public function getFunction(): \Closure {
|
|
return $this->function;
|
|
}
|
|
|
|
public function getPriority(): int {
|
|
return $this->priority;
|
|
}
|
|
}
|