Automattic\WooCommerce\Internal\EmailEditor
PageRenderer::load_editor_assets()
Load editor assets.
Метод класса: PageRenderer{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->load_editor_assets( $post ): void;
- $post(\WP_Post) (обязательный)
- Current post being edited.
Код PageRenderer::load_editor_assets() PageRenderer::load editor assets WC 9.8.2
private function load_editor_assets( \WP_Post $post ): void { // Load the email editor integration script. // The JS file is located in plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/index.ts. WCAdminAssets::register_script( 'wp-admin-scripts', 'email-editor-integration', true ); $email_editor_assets_path = WC_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'email-editor/'; $email_editor_assets_url = WC()->plugin_url() . '/' . WC_ADMIN_DIST_JS_FOLDER . 'email-editor/'; // Email editor rich text JS - Because the Personalization Tags depend on Gutenberg 19.8.0 and higher // the following code replaces used Rich Text for the version containing the necessary changes. $rich_text_assets_params = require $email_editor_assets_path . 'rich-text.asset.php'; wp_deregister_script( 'wp-rich-text' ); wp_enqueue_script( 'wp-rich-text', $email_editor_assets_url . 'rich-text.js', $rich_text_assets_params['dependencies'], $rich_text_assets_params['version'], true ); // End of replacing Rich Text package. $file_name = 'index'; $assets_params = require $email_editor_assets_path . "{$file_name}.asset.php"; wp_enqueue_script( 'woocommerce_email_editor', $email_editor_assets_url . "{$file_name}.js", $assets_params['dependencies'], $assets_params['version'], true ); wp_enqueue_style( 'woocommerce_email_editor', $email_editor_assets_url . "{$file_name}.css", array(), $assets_params['version'] ); $current_user_email = wp_get_current_user()->user_email; wp_localize_script( 'woocommerce_email_editor', 'MailPoetEmailEditor', array( 'current_post_type' => esc_js( $post->post_type ), 'current_post_id' => $post->ID, 'current_wp_user_email' => esc_js( $current_user_email ), 'editor_settings' => $this->settings_controller->get_settings(), 'editor_theme' => $this->theme_controller->get_base_theme()->get_raw_data(), 'user_theme_post_id' => $this->user_theme->get_user_theme_post()->ID, 'urls' => array( 'listings' => admin_url( 'edit.php?post_type=' . Integration::EMAIL_POST_TYPE ), 'send' => admin_url( 'edit.php?post_type=' . Integration::EMAIL_POST_TYPE ), ), ) ); }