_deprecated_hook ( string $hook, string $release, string $replacement = null, string $message = null )
Marks a deprecated action or filter hook as deprecated and throws a notice.
Default behavior is to trigger a user error if APP_ENV
is set to DEV.
This function is called by the hook::do_action_deprecated() and Hook::apply_filter_deprecated() functions, and so generally does not need to be called directly.
Source file: app/functions/hook-function.php
Parameters
- $hook
-
(string) (Required) The hook that was used.
- $release
-
(string) (Required) The release of eduTrac SIS that deprecated the hook.
- $replacement
-
(string) (Optional) The hook that should have been used.
Default value: null
- $message
-
(string) (Optional) A message regarding the change.
Default value: null
Used by
Uses
- app/functions/dependency.php: _trigger_error()
Source
function _deprecated_hook($hook, $release, $replacement = null, $message = null) { $app = \Liten\Liten::getInstance(); /** * Fires when a deprecated hook is called. * * @since 6.3.0 * * @param string $hook The hook that was called. * @param string $replacement The hook that should be used as a replacement. * @param string $release The release of eduTrac SIS that deprecated the argument used. * @param string $message A message regarding the change. */ $app->hook->do_action('deprecated_hook_run', $hook, $replacement, $release, $message); /** * Filters whether to trigger deprecated hook errors. * * @since 6.3.0 * * @param bool $trigger Whether to trigger deprecated hook errors. Requires * `APP_DEV` to be defined DEV. */ if (APP_ENV == 'DEV' && $app->hook->apply_filter('deprecated_hook_trigger_error', true)) { $message = empty($message) ? '' : ' ' . $message; if (!is_null($replacement)) { _trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since release %2$s! Use %3$s instead.'), $hook, $release, $replacement) . $message, E_USER_DEPRECATED); } else { _trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since release %2$s with no alternative available.'), $hook, $release) . $message, E_USER_DEPRECATED); } } }
Expand full source code Collapse full source code View on Github
Changelog
- Since: eduTrac SIS 6.3.0