2019-05-06 04:39:10 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Plugin Name: WooCommerce Admin Dashboard Section Example
|
|
|
|
*
|
2020-08-11 19:18:47 +00:00
|
|
|
* @package WooCommerce\Admin
|
2019-05-06 04:39:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the JS.
|
|
|
|
*/
|
|
|
|
function dashboard_section_register_script() {
|
|
|
|
|
2019-08-12 21:52:09 +00:00
|
|
|
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Loader' ) || ! \Automattic\WooCommerce\Admin\Loader::is_admin_page() ) {
|
2019-05-06 04:39:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp_register_script(
|
2019-05-23 23:58:00 +00:00
|
|
|
'dashboard_section',
|
2019-05-06 04:39:10 +00:00
|
|
|
plugins_url( '/dist/index.js', __FILE__ ),
|
|
|
|
array(
|
|
|
|
'wp-hooks',
|
|
|
|
'wp-element',
|
|
|
|
'wp-i18n',
|
|
|
|
'wc-components',
|
|
|
|
),
|
|
|
|
filemtime( dirname( __FILE__ ) . '/dist/index.js' ),
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2019-05-23 23:58:00 +00:00
|
|
|
wp_enqueue_script( 'dashboard_section' );
|
2019-05-06 04:39:10 +00:00
|
|
|
}
|
|
|
|
add_action( 'admin_enqueue_scripts', 'dashboard_section_register_script' );
|