summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/general/hooks.rst
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2011-10-06 00:22:53 +0200
committerDerek Jones <derek.jones@ellislab.com>2011-10-06 00:22:53 +0200
commita1360ef24fff8b57353db32ad6045969af28e5d5 (patch)
tree6646e2ccd20a75af67adbb4c8fe1d53d4c6c5ff1 /user_guide_src/source/general/hooks.rst
parent129c181c99848ae14c7edbbaeb7d0bf78ac2db55 (diff)
fixing code spacing in Profiling, Models, Managing Apps, Hooks, and Helpers general docs
Diffstat (limited to 'user_guide_src/source/general/hooks.rst')
-rw-r--r--user_guide_src/source/general/hooks.rst24
1 files changed, 22 insertions, 2 deletions
diff --git a/user_guide_src/source/general/hooks.rst b/user_guide_src/source/general/hooks.rst
index ab42d28a1..65696f6c7 100644
--- a/user_guide_src/source/general/hooks.rst
+++ b/user_guide_src/source/general/hooks.rst
@@ -26,7 +26,13 @@ Defining a Hook
Hooks are defined in application/config/hooks.php file. Each hook is
specified as an array with this prototype::
- $hook['pre_controller'] = array(                                 'class'    => 'MyClass',                                 'function' => 'Myfunction',                                 'filename' => 'Myclass.php',                                 'filepath' => 'hooks',                                 'params'   => array('beer', 'wine', 'snacks')                                 );
+ $hook['pre_controller'] = array(
+ 'class' => 'MyClass',
+ 'function' => 'Myfunction',
+ 'filename' => 'Myclass.php',
+ 'filepath' => 'hooks',
+ 'params' => array('beer', 'wine', 'snacks')
+ );
**Notes:**
The array index correlates to the name of the particular hook point you
@@ -54,7 +60,21 @@ Multiple Calls to the Same Hook
If want to use the same hook point with more then one script, simply
make your array declaration multi-dimensional, like this::
- $hook['pre_controller'][] = array(                                 'class'    => 'MyClass',                                 'function' => 'Myfunction',                                 'filename' => 'Myclass.php',                                 'filepath' => 'hooks',                                 'params'   => array('beer', 'wine', 'snacks')                                 ); $hook['pre_controller'][] = array(                                 'class'    => 'MyOtherClass',                                 'function' => 'MyOtherfunction',                                 'filename' => 'Myotherclass.php',                                 'filepath' => 'hooks',                                 'params'   => array('red', 'yellow', 'blue')                                 );
+ $hook['pre_controller'][] = array(
+ 'class' => 'MyClass',
+ 'function' => 'Myfunction',
+ 'filename' => 'Myclass.php',
+ 'filepath' => 'hooks',
+ 'params' => array('beer', 'wine', 'snacks')
+ );
+
+ $hook['pre_controller'][] = array(
+ 'class' => 'MyOtherClass',
+ 'function' => 'MyOtherfunction',
+ 'filename' => 'Myotherclass.php',
+ 'filepath' => 'hooks',
+ 'params' => array('red', 'yellow', 'blue')
+ );
Notice the brackets after each array index::