Automattic\WooCommerce\Internal\AbilitiesApi
AbilitiesClient::enable
Enable the WordPress Abilities API client for admin pages.
This is the main method external plugins should use to enable the abilities API JavaScript client.
Method of the class: AbilitiesClient{}
No Hooks.
Returns
true|false. True if successfully enabled, false otherwise.
Usage
$result = AbilitiesClient::enable(): bool;
AbilitiesClient::enable() AbilitiesClient::enable code WC 10.4.3
public static function enable(): bool {
// Only enable once.
if ( self::$enabled ) {
return true;
}
// Hook into admin_enqueue_scripts to enqueue when needed.
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_for_admin' ) );
self::$enabled = true;
return true;
}