RedirectionController
in package
Handle redirecting to the old or new editor based on features and support.
Table of Contents
- $product_templates : array<string|int, mixed>
- Registered product templates.
- __construct() : mixed
- Set up the hooks used for redirection.
- maybe_redirect_to_new_editor() : void
- Redirects from old product form to the new product form if the feature `product_block_editor` is enabled.
- maybe_redirect_to_old_editor() : void
- Redirects from new product form to the old product form if the feature `product_block_editor` is enabled.
- redirect_non_supported_product_types() : void
- Redirect non supported product types to legacy editor.
- set_product_templates() : void
- Check if a product is supported by the new experience.
- get_parsed_route() : array<string|int, mixed>
- Get the parsed WooCommerce Admin path.
- is_legacy_add_new_screen() : bool
- Check if the current screen is the legacy add product screen.
- is_legacy_edit_screen() : bool
- Check if the current screen is the legacy edit product screen.
- is_product_supported() : bool
- Check if a product is supported by the new experience.
Properties
$product_templates
Registered product templates.
private
array<string|int, mixed>
$product_templates
= array()
Methods
__construct()
Set up the hooks used for redirection.
public
__construct() : mixed
Return values
mixed —maybe_redirect_to_new_editor()
Redirects from old product form to the new product form if the feature `product_block_editor` is enabled.
public
maybe_redirect_to_new_editor() : void
Return values
void —maybe_redirect_to_old_editor()
Redirects from new product form to the old product form if the feature `product_block_editor` is enabled.
public
maybe_redirect_to_old_editor() : void
Return values
void —redirect_non_supported_product_types()
Redirect non supported product types to legacy editor.
public
redirect_non_supported_product_types() : void
Return values
void —set_product_templates()
Check if a product is supported by the new experience.
public
set_product_templates(array<string|int, mixed> $product_templates) : void
Parameters
- $product_templates : array<string|int, mixed>
-
The registered product teamplates.
Return values
void —get_parsed_route()
Get the parsed WooCommerce Admin path.
protected
get_parsed_route() : array<string|int, mixed>
Return values
array<string|int, mixed> —is_legacy_add_new_screen()
Check if the current screen is the legacy add product screen.
protected
is_legacy_add_new_screen() : bool
Return values
bool —is_legacy_edit_screen()
Check if the current screen is the legacy edit product screen.
protected
is_legacy_edit_screen() : bool
Return values
bool —is_product_supported()
Check if a product is supported by the new experience.
protected
is_product_supported(int $product_id) : bool
Parameters
- $product_id : int
-
Product ID.