aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Extension.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-06 18:48:00 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-06 18:48:00 +0100
commit08546af75ff9a25eac3409649ea4660fe070720c (patch)
treea0df2509bf698799d3b11bd94b49c823e53f6a10 /lib/Minz/Extension.php
parentbc81979a6b25554c4832d5ccb41b427023096463 (diff)
Add a first draft for hooks
- New Extension->registerHook($hook_name, $hook_function) method to register a new hook - Only one hook works for the moment: entry_before_insert - ExtensionManager::callHook will need to evolve based on future hooks See https://github.com/FreshRSS/FreshRSS/issues/252
Diffstat (limited to 'lib/Minz/Extension.php')
-rw-r--r--lib/Minz/Extension.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php
index 490a5c5cb..c93ba2520 100644
--- a/lib/Minz/Extension.php
+++ b/lib/Minz/Extension.php
@@ -153,4 +153,14 @@ class Minz_Extension {
public function registerViews() {
Minz_View::addBasePathname($this->path);
}
+
+ /**
+ * Register a new hook.
+ *
+ * @param $hook_name the hook name (must exist).
+ * @param $hook_function the function name to call (must be callable).
+ */
+ public function registerHook($hook_name, $hook_function) {
+ Minz_ExtensionManager::addHook($hook_name, $hook_function, $this);
+ }
}