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
$assets_path
Email editor assets path.
private
string
$assets_path
= ''
$assets_url
Email editor assets URL.
private
string
$assets_url
= ''
$logger
Logger instance.
private
Email_Editor_Logger
$logger
$settings_controller
Settings controller instance.
private
Settings_Controller
$settings_controller
$theme_controller
Theme controller instance.
private
Theme_Controller
$theme_controller
$user_theme
User theme instance.
private
User_Theme
$user_theme
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 —enqueue_admin_styles()
Enqueue admin styles that are needed by the email editor.
public
enqueue_admin_styles() : void
Return values
void —initialize()
Initialize the assets manager.
public
initialize() : void
Return values
void —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 —set_assets_path()
Sets the path for the email editor assets.
public
set_assets_path(string $assets_path) : void
Parameters
- $assets_path : string
-
The path to the email editor assets directory.
Return values
void —set_assets_url()
Sets the URL for the email editor assets.
public
set_assets_url(string $assets_url) : void
Parameters
- $assets_url : string
-
The URL to the email editor assets directory.
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.