MDL-79144 hooks: allow hooks to return tags
This commit is contained in:
@@ -35,4 +35,11 @@ interface described_hook {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_hook_description(): string;
|
||||
|
||||
/**
|
||||
* List of tags that describe this hook.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function get_hook_tags(): array;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ final class hooks implements \core\hook\discovery_agent {
|
||||
|
||||
if (is_subclass_of($classname, \core\hook\described_hook::class)) {
|
||||
$hooks[$classname]['description'] = $classname::get_hook_description();
|
||||
$hooks[$classname]['tags'] = $classname::get_hook_tags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+9
@@ -41,4 +41,13 @@ final class hook implements
|
||||
public static function get_deprecated_plugin_callbacks(): array {
|
||||
return ['oldcallback'];
|
||||
}
|
||||
|
||||
/**
|
||||
* List of tags that describe this hook.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function get_hook_tags(): array {
|
||||
return ['test'];
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -53,4 +53,13 @@ final class stoppablehook implements
|
||||
public function isPropagationStopped(): bool {
|
||||
return $this->stopped;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of tags that describe this hook.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function get_hook_tags(): array {
|
||||
return ['test'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user