From 08c5b507bbaf4937ff637bd138f64119873e2922 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 12 Nov 2011 14:49:36 -0500 Subject: cleaned up the plugin hooks documentation --- documentation/examples/hooks/basic.php | 41 ++++++++++------------------------ 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'documentation/examples/hooks/basic.php') diff --git a/documentation/examples/hooks/basic.php b/documentation/examples/hooks/basic.php index 71076ee96..734d9e884 100644 --- a/documentation/examples/hooks/basic.php +++ b/documentation/examples/hooks/basic.php @@ -1,34 +1,17 @@ 'Joe'); -$items = elgg_trigger_plugin_hook('get_items', 'example', $params, $default); +function example_plugin_hook_handler($hook, $type, $value, $params) { + var_dump($hook); + var_dump($type); + var_dump($value); + var_dump($params); -var_dump($items); - -function example_plugin_hook($hook, $type, $value, $params) { - if (is_array($value)) { - $value[] = "Hook Value 1"; - $value[] = "Hook Value 2"; - } - - return $value; -} - -function example_plugin_hook_2($hook, $type, $value, $params) { - $username = isset($params['username']) ? $params['username'] : NULL; - if (is_array($value)) { - switch($username) { - case 'Joe': - $value[] = "Joe's item"; - break; - case 'John': - $value[] = "Joe's item"; - break; - } - } - - return $value; + // we are not changing $value so return null + return null; } -- cgit v1.2.3