PluginProbe
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables / 2.2.13
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables v2.2.13
2.2.13 2.2.12 2.2.11 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 trunk 1.0.0 1.0.1 2.0.0 2.0.1 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2
table-builder-block / includes / Elementor / TablekitElementorEditor.php

TablekitElementorEditor.php in TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables 2.2.13, at includes/Elementor/TablekitElementorEditor.php

67 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor editor assets for TableKit
4 *
5 * @package TableKit
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Enqueues TableKit's editor-only styles/scripts within the Elementor editor.
14 */
15 class TableKit_Elementor_Editor {
16
17 /**
18 * Hooks editor asset enqueueing into the Elementor editor lifecycle.
19 *
20 * @return void
21 */
22 public static function register(): void {
23 add_action( 'elementor/editor/after_enqueue_styles', array( __CLASS__, 'enqueue_editor_styles' ) );
24 add_action( 'elementor/editor/after_enqueue_scripts', array( __CLASS__, 'enqueue_editor_scripts' ) );
25 }
26
27 /**
28 * Enqueues TableKit's stylesheet for the Elementor editor screen.
29 *
30 * @return void
31 */
32 public static function enqueue_editor_styles(): void {
33 wp_enqueue_style(
34 'tablekit-elementor-editor',
35 TABLE_BUILDER_BLOCK_PLUGIN_URL . 'assets/css/elementor-editor.css',
36 array(),
37 TABLE_BUILDER_BLOCK_PLUGIN_VERSION
38 );
39 }
40
41 /**
42 * Enqueues the Elementor-editor block-picker script and localizes its data.
43 *
44 * @return void
45 */
46 public static function enqueue_editor_scripts(): void {
47 wp_enqueue_script(
48 'tablekit-editor-block-picker',
49 TABLE_BUILDER_BLOCK_PLUGIN_URL . 'assets/js/elementor-editor-block-picker.js',
50 array( 'elementor-editor', 'jquery' ),
51 TABLE_BUILDER_BLOCK_PLUGIN_VERSION,
52 true
53 );
54
55 wp_localize_script(
56 'tablekit-editor-block-picker',
57 'tablekitEditorData',
58 array(
59 'restUrl' => rest_url( 'tablekit/v1/table-blocks' ),
60 'nonce' => wp_create_nonce( 'wp_rest' ),
61 'allLabel' => __( '— All Blocks —', 'table-builder-block' ),
62 'loading' => __( 'Loading blocks…', 'table-builder-block' ),
63 )
64 );
65 }
66 }
67