Skip to content

Commit e4ab89f

Browse files
committed
✨ add hooks() helper function
Signed-off-by: otengkwame <[email protected]>
1 parent ebe2687 commit e4ab89f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

CodeIgniter/Framework/core/Common.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,33 @@ function calendar($config = [])
295295

296296
// ------------------------------------------------------------------------
297297

298+
if ( ! function_exists('hooks'))
299+
{
300+
/**
301+
* Helper function to load and return an instance of the Hooks class.
302+
*
303+
* This function loads and returns an instance of the Hooks class,
304+
* which is responsible for handling hooks in the application.
305+
*
306+
* @return Hooks An instance of the Hooks class.
307+
*
308+
*/
309+
function hooks()
310+
{
311+
/**
312+
* Instance of the Hooks class.
313+
*
314+
* @var Hooks
315+
*/
316+
$hooks =& load_class('Hooks', 'core');
317+
318+
// Return the instance of the Hooks class.
319+
return $hooks;
320+
}
321+
}
322+
323+
// ------------------------------------------------------------------------
324+
298325
if ( ! function_exists('load_class'))
299326
{
300327
/**

0 commit comments

Comments
 (0)