WooCommerce Code Reference

Search results

WC_Deprecated_Hooks

WC_Deprecated_Hooks class maps old actions and filters to new ones. This is the base class for handling those deprecated hooks.

Based on the WCS_Hook_Deprecator class by Prospress.

Table of Contents

$deprecated_hooks Array of deprecated hooks we need to handle. array
$deprecated_version Array of versions on each hook has been deprecated. array
__construct() Constructor. mixed
hook_in() Hook into the new hook so we can handle deprecated hooks once fired. mixed
get_old_hooks() Get old hooks to map to new hook. array
maybe_handle_deprecated_hook() If the hook is Deprecated, call the old hooks here. mixed
handle_deprecated_hook() If the old hook is in-use, trigger it. mixed
get_deprecated_version() Get deprecated version. string
display_notice() Display a deprecated notice for old hooks. mixed
trigger_hook() Fire off a legacy hook with it's args. mixed

Properties

Methods

hook_in()

Hook into the new hook so we can handle deprecated hooks once fired.

public abstract hook_in( $hook_name : string ) : mixed
Parameters
$hook_name : string

Hook name.

Return values
mixed

get_old_hooks()

Get old hooks to map to new hook.

public get_old_hooks( $new_hook : string ) : array
Parameters
$new_hook : string

New hook name.

Return values
array

maybe_handle_deprecated_hook()

If the hook is Deprecated, call the old hooks here.

public maybe_handle_deprecated_hook( ) : mixed
Return values
mixed

handle_deprecated_hook()

If the old hook is in-use, trigger it.

public abstract handle_deprecated_hook( $new_hook : string , $old_hook : string , $new_callback_args : array , $return_value : mixed ) : mixed
Parameters
$new_hook : string

New hook name.

$old_hook : string

Old hook name.

$new_callback_args : array

New callback args.

$return_value : mixed

Returned value.

Return values
mixed

get_deprecated_version()

Get deprecated version.

protected get_deprecated_version( $old_hook : string ) : string
Parameters
$old_hook : string

Old hook name.

Return values
string

display_notice()

Display a deprecated notice for old hooks.

protected display_notice( $old_hook : string , $new_hook : string ) : mixed
Parameters
$old_hook : string

Old hook.

$new_hook : string

New hook.

Return values
mixed

trigger_hook()

Fire off a legacy hook with it's args.

protected abstract trigger_hook( $old_hook : string , $new_callback_args : array ) : mixed
Parameters
$old_hook : string

Old hook name.

$new_callback_args : array

New callback args.

Return values
mixed
Back to the top