do_action

Description

Executes functions hooked to a specific action hook.

Usage

<?php $app->hook->do_action($hook, $arg); ?>

Parameters

$hook: (string) (required) The name of the hook that should be executed.

$arg: (mixed) (optional) Additional arguments passed to functions hooked to the action.

Example

$app = \Liten\Liten::getInstance();

/**
 * Hook with an argument.
 */
$app->hook->do_action('my_custom_hook', $arg);

function my_custom_function($arg) {
    var_dump($arg);
}
$app->hook->add_action('my_custom_hook', 'my_custom_function', 10, 1);

Change Log

Since 1.0.0

Source File

$app->hook->do_action() is located in app/src/Hooks.php.