Automattic\WooCommerce\Internal\StockNotifications\Admin
AdminManager::admin_resources
Admin scripts.
Method of the class: AdminManager{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = AdminManager::admin_resources();
AdminManager::admin_resources() AdminManager::admin resources code WC 10.3.6
public static function admin_resources() {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
$suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
$version = Constants::get_constant( 'WC_VERSION' );
wp_register_script( 'wc-admin-customer-stock-notifications', WC()->plugin_url() . '/assets/js/admin/wc-customer-stock-notifications' . $suffix . '.js', array( 'jquery' ), $version, true );
$params = array(
'i18n_wc_delete_notification_warning' => __( 'Delete this notification permanently?', 'woocommerce' ),
'i18n_wc_bulk_delete_notifications_warning' => __( 'Delete the selected notifications permanently?', 'woocommerce' ),
);
/*
* Enqueue specific styles & scripts.
*/
if (
! in_array(
$screen_id,
array( 'woocommerce_page_wc-customer-stock-notifications', 'woocommerce_page_wc-settings' ),
true
)
) {
return;
}
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'woocommerce_page_wc-settings' === $screen_id && isset( $_GET['section'] ) && 'customer_stock_notifications' !== $_GET['section'] ) {
return;
}
wp_enqueue_script( 'wc-admin-customer-stock-notifications' );
wp_localize_script( 'wc-admin-customer-stock-notifications', 'wc_admin_customer_stock_notifications_params', $params );
}