WooCommerce Code Reference

HandlerRegistry
in package

HandlerRegistry class.

Manages collection handlers.

Table of Contents

$collection_handler_store  : array<string|int, mixed>
Associative array of collection handlers.
get_collection_handler()  : array<string|int, mixed>|null
Get collection handler by name.
register_collection_handlers()  : mixed
Register handlers for a collection.
register_core_collections()  : mixed
Register core collection handlers.
unregister_collection_handlers()  : mixed
Removes any custom collection handlers for the given collection.
get_product_ids_from_order()  : array<string|int, int>
Get product IDs from an order.

Properties

Methods

get_collection_handler()

Get collection handler by name.

public get_collection_handler(string $name) : array<string|int, mixed>|null
Parameters
$name : string

Collection name.

Return values
array<string|int, mixed>|nullCollection handler array or null if not found.

register_collection_handlers()

Register handlers for a collection.

public register_collection_handlers(string $collection_name, callable $build_query[, callable|null $frontend_args = null ][, callable|null $editor_args = null ][, callable|null $preview_query = null ]) : mixed
Parameters
$collection_name : string

The name of the collection.

$build_query : callable

The query builder callable.

$frontend_args : callable|null = null

Optional frontend args callable.

$editor_args : callable|null = null

Optional editor args callable.

$preview_query : callable|null = null

Optional preview query callable.

Tags
throws
InvalidArgumentException

If handlers are already registered for the collection.

Return values
mixed

unregister_collection_handlers()

Removes any custom collection handlers for the given collection.

public unregister_collection_handlers(string $collection_name) : mixed
Parameters
$collection_name : string

The name of the collection to unregister.

Return values
mixed

get_product_ids_from_order()

Get product IDs from an order.

private get_product_ids_from_order(int $order_id) : array<string|int, int>
Parameters
$order_id : int

The order ID.

Return values
array<string|int, int>The product IDs.