MDL-79144 hooks: allow hooks to return tags

This commit is contained in:
Marina Glancy
2023-08-25 13:53:09 +01:00
parent cccc00954d
commit 4d5c4b471d
4 changed files with 26 additions and 0 deletions
+7
View File
@@ -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;
}
+1
View File
@@ -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();
}
}
+9
View File
@@ -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
View File
@@ -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'];
}
}