' . __( 'Settings', 'woocommerce-custom-thank-you-pages' ) . ''
), $links );
return $links;
}
add_action( 'plugin_action_links_' . plugin_basename( WOOCOMMERCE_CUSTOM_THANK_YOU_PAGES_FILE ), 'WooCommerce_Custom_Thank_You_Pages\Admin\plugin_action_links' );
/**
* Enqueue admin scripts.
*
* Enqueue the required javascripts and stylesheets.
*
* @since 1.0.0
*
* @param $hook
*/
function enqueue_scripts( $hook ) {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_script( 'custom-thank-you-pages', plugins_url( 'assets/admin/js/woocommerce-custom-thank-you-pages' . $suffix . '.js', \WooCommerce_Custom_Thank_You_Pages\WooCommerce_Custom_Thank_You_Pages()->file ), array( 'jquery' ), \WooCommerce_Custom_Thank_You_Pages\WooCommerce_Custom_Thank_You_Pages()->version, true );
wp_localize_script( 'custom-thank-you-pages', 'wcctyp', array(
'nonce' => wp_create_nonce( 'wcctyp-ajax-nonce' ),
'i18n' => array(
'noChange' => __( '— No Change —' ),
),
) );
if ( get_post_type() == 'product' || ( isset( $_GET['page'] ) && $_GET['page'] == 'wc-settings' && isset( $_GET['section'] ) && $_GET['section'] == 'thank-you-pages' ) ) {
wp_enqueue_script( 'select2' );
wp_enqueue_script( 'custom-thank-you-pages' );
}
}
add_action( 'admin_enqueue_scripts', 'WooCommerce_Custom_Thank_You_Pages\Admin\enqueue_scripts' );
/**
* Inline scripts.
*
* Print inline scripts for this plugin. It only adds them on the required pages.
* Inline scripts have been chosen as they are too small to warrant extra GET requests.
*
* @since 1.0.0
*/
function admin_footer_scripts() {
if ( get_post_type() !== 'product' && ( isset( $_GET['page'] ) && $_GET['page'] !== 'wc-settings' ) || ( isset( $_GET['section'] ) && $_GET['section'] !== 'thank-you-pages' ) ) {
return;
}
?>