apply_filter

Description

Calls the functions added to a filter hook.

Usage

<?php $app->hook->apply_filter($hook, $value); ?>

Parameters

$hook: (string) (required) The name of the filter hook.

$value: (mixed) (required) The value that can be modified by filters hooked to $hook.

Return Values

(mixed) The result of $value after all hooked functions are applied to it.

Example

Return or echo after filtering.

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

return $app->hook->apply_filter('hook_filter', $value, $arg_1, $arg_2);

echo $app->hook->apply_filter('hook_filter', $value, $arg_1, $arg_2);

Change Log

Since 1.0.0

Source File

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

  • apply_filter()
  • add_filter()
  • remove_filter()
  • remove_all_filters()
  • has_filter()