Hook::is()
Checks the hook name that is being executed.
Table of Contents
Description
Hook::is(?string $name = null): bool;
This method checks the name of the currently executing hook container. Useful when applied to multiple hooks executing concurrently with the same hook function. I’d rather suggest you to create an individual function for each hook container if it doesn’t seem repetitive. It’s easier to read that way.
Example
Hook::set([
'content',
'title',
'type'
], static function ($v) {
if (Hook::is('content')) {
return '<p>' . $v . '</p>';
}
if (Hook::is('title')) {
return '<h2>' . $v . '</h2>';
}
return $v;
});
Hook::_()
The dynamic method initiator.
Hook::__callStatic()
Proxy for missing static methods.
Hook::fire()
Triggers hooks by its container name.
Hook::get()
Gets hooks by its container name.
Hook::is()
Checks the hook name that is being executed.
Hook::let()
Deletes hooks by its container name.
Hook::set()
Sets hooks by its container name.