| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The file register assets for the plugin |
| 5 |
* |
| 6 |
* @package Tableberg |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Tableberg; |
| 10 |
|
| 11 |
/** |
| 12 |
* Handle plugin assets |
| 13 |
*/ |
| 14 |
class Assets { |
| 15 |
/** |
| 16 |
* Register blocks assets |
| 17 |
*/ |
| 18 |
public function register_blocks_assets() { |
| 19 |
wp_register_script( |
| 20 |
'tableberg-script', |
| 21 |
TABLEBERG_URL . 'build/tableberg.build.js', |
| 22 |
array( |
| 23 |
'lodash', |
| 24 |
'react', |
| 25 |
'wp-block-editor', |
| 26 |
'wp-blocks', |
| 27 |
'wp-components', |
| 28 |
'wp-data', |
| 29 |
'wp-element', |
| 30 |
'wp-i18n', |
| 31 |
'wp-primitives', |
| 32 |
), |
| 33 |
Constants::plugin_version(), |
| 34 |
false |
| 35 |
); |
| 36 |
wp_register_style( |
| 37 |
'tableberg-editor-style', |
| 38 |
TABLEBERG_URL . 'build/tableberg-editor-style.css', |
| 39 |
array(), |
| 40 |
Constants::plugin_version(), |
| 41 |
false |
| 42 |
); |
| 43 |
wp_register_style( |
| 44 |
'tableberg-style', |
| 45 |
TABLEBERG_URL . 'build/tableberg-frontend-style.css', |
| 46 |
array(), |
| 47 |
Constants::plugin_version(), |
| 48 |
false |
| 49 |
); |
| 50 |
} |
| 51 |
/** |
| 52 |
* Enqueue Admin assets |
| 53 |
*/ |
| 54 |
public function register_admin_assets() { |
| 55 |
wp_enqueue_script( |
| 56 |
'tableberg-admin-script', |
| 57 |
TABLEBERG_URL . 'build/tableberg-admin.build.js', |
| 58 |
array( |
| 59 |
'lodash', |
| 60 |
'react', |
| 61 |
'wp-block-editor', |
| 62 |
'wp-blocks', |
| 63 |
'wp-components', |
| 64 |
'wp-data', |
| 65 |
'wp-element', |
| 66 |
'wp-i18n', |
| 67 |
'wp-primitives', |
| 68 |
), |
| 69 |
Constants::plugin_version(), |
| 70 |
true |
| 71 |
); |
| 72 |
$frontend_script_data = apply_filters('tableberg/filter/admin_settings_menu_data', array()); |
| 73 |
wp_localize_script('tableberg-admin-script', 'tablebergAdminMenuData', $frontend_script_data); |
| 74 |
wp_enqueue_style( |
| 75 |
'tableberg-admin-style', |
| 76 |
TABLEBERG_URL . 'build/tableberg-admin-style.css', |
| 77 |
array(), |
| 78 |
Constants::plugin_version(), |
| 79 |
'all' |
| 80 |
); |
| 81 |
} |
| 82 |
} |
| 83 |
|