WooCommerce Code Reference

Assets_Manager
in package

Class responsible for managing email editor assets.

Table of Contents

$assets_path  : string
Email editor assets path.
$assets_url  : string
Email editor assets URL.
$logger  : Email_Editor_Logger
Logger instance.
$settings_controller  : Settings_Controller
Settings controller instance.
$theme_controller  : Theme_Controller
Theme controller instance.
$user_theme  : User_Theme
User theme instance.
__construct()  : mixed
Assets Manager constructor with all dependencies.
enqueue_admin_styles()  : void
Enqueue admin styles that are needed by the email editor.
initialize()  : void
Initialize the assets manager.
load_editor_assets()  : void
Load editor assets.
render_email_editor_html()  : void
Render the email editor's required HTML and admin header.
set_assets_path()  : void
Sets the path for the email editor assets.
set_assets_url()  : void
Sets the URL for the email editor assets.
preload_rest_api_data()  : void
Preload REST API data for the email editor.

Properties

Methods

__construct()

Assets Manager constructor with all dependencies.

public __construct(Settings_Controller $settings_controller, Theme_Controller $theme_controller, User_Theme $user_theme, Email_Editor_Logger $logger) : mixed
Parameters
$settings_controller : Settings_Controller

Settings controller instance.

$theme_controller : Theme_Controller

Theme controller instance.

$user_theme : User_Theme

User theme instance.

$logger : Email_Editor_Logger

Email editor logger instance.

Return values
mixed

load_editor_assets()

Load editor assets.

public load_editor_assets(WP_Post|WP_Block_Template $edited_item, string $script_name) : void
Parameters
$edited_item : WP_Post|WP_Block_Template

The edited post or template.

$script_name : string

The name of the registered script.

Return values
void

render_email_editor_html()

Render the email editor's required HTML and admin header.

public render_email_editor_html([string $element_id = 'woocommerce-email-editor' ]) : void
Parameters
$element_id : string = 'woocommerce-email-editor'

Optional. The ID of the main container element. Default is 'woocommerce-email-editor'.

Return values
void

preload_rest_api_data()

Preload REST API data for the email editor.

private preload_rest_api_data(int|string $post_id, string $post_type) : void
Parameters
$post_id : int|string

The post ID.

$post_type : string

The post type.

Return values
void