Fix typo in metabox example, and use `::class` constant for `class_exists()` examples
parent
002a72b2cb
commit
4e91772f65
|
@ -169,7 +169,7 @@ The following snippet shows a way to add meta boxes to the legacy order editor s
|
||||||
```php
|
```php
|
||||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||||
|
|
||||||
add_action( 'add_meta_boxes', 'xyz_metabox' );
|
add_action( 'add_meta_boxes', 'add_xyz_metabox' );
|
||||||
|
|
||||||
function add_xyz_metabox() {
|
function add_xyz_metabox() {
|
||||||
$screen = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
|
$screen = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
|
||||||
|
@ -205,7 +205,7 @@ Once you examined the extension's code, you can declare whether it's compatible
|
||||||
```php
|
```php
|
||||||
|
|
||||||
add_action( 'before_woocommerce_init', function() {
|
add_action( 'before_woocommerce_init', function() {
|
||||||
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
|
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
|
||||||
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
|
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -217,7 +217,7 @@ If you know your code doesn't support HPOS, you should declare **incompatibility
|
||||||
```php
|
```php
|
||||||
|
|
||||||
add_action( 'before_woocommerce_init', function() {
|
add_action( 'before_woocommerce_init', function() {
|
||||||
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
|
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
|
||||||
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, false );
|
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, false );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue