Create an interface for classes that need to register hooks
This commit is contained in:
parent
fa0c4782a7
commit
f03821904b
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Renders order edit page, works with both post and order object.
|
* Renders order edit page, works with both post and order object.
|
||||||
|
*
|
||||||
|
* phpcs:disable Generic.Commenting.DocComment.MissingShort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Internal\Admin\Orders;
|
namespace Automattic\WooCommerce\Internal\Admin\Orders;
|
||||||
|
@ -232,7 +234,7 @@ class Edit {
|
||||||
/* Translators: %s order type name. */
|
/* Translators: %s order type name. */
|
||||||
sprintf( __( '%s information', 'woocommerce' ), $title ),
|
sprintf( __( '%s information', 'woocommerce' ), $title ),
|
||||||
function( $post_or_order ) use ( $source_attribution_meta_box ) {
|
function( $post_or_order ) use ( $source_attribution_meta_box ) {
|
||||||
$order = $post_or_order instanceof WC_Order ?: wc_get_order( $post_or_order );
|
$order = $post_or_order instanceof WC_Order ? $post_or_order : wc_get_order( $post_or_order );
|
||||||
$source_attribution_meta_box->output( $order );
|
$source_attribution_meta_box->output( $order );
|
||||||
},
|
},
|
||||||
$screen_id,
|
$screen_id,
|
||||||
|
@ -247,7 +249,7 @@ class Edit {
|
||||||
'woocommerce-customer-history',
|
'woocommerce-customer-history',
|
||||||
__( 'Customer History', 'woocommerce' ),
|
__( 'Customer History', 'woocommerce' ),
|
||||||
function( $post_or_order ) use ( $customer_history_meta_box ) {
|
function( $post_or_order ) use ( $customer_history_meta_box ) {
|
||||||
$order = $post_or_order instanceof WC_Order ?: wc_get_order( $post_or_order );
|
$order = $post_or_order instanceof WC_Order ? $post_or_order : wc_get_order( $post_or_order );
|
||||||
$customer_history_meta_box->output( $order );
|
$customer_history_meta_box->output( $order );
|
||||||
},
|
},
|
||||||
$screen_id,
|
$screen_id,
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
declare( strict_types=1 );
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Internal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface RegisterHooksInterface
|
||||||
|
*
|
||||||
|
* @since x.x.x
|
||||||
|
*/
|
||||||
|
interface RegisterHooksInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register this class instance to the appropriate hooks.
|
||||||
|
*
|
||||||
|
* @since x.x.x
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register();
|
||||||
|
}
|
Loading…
Reference in New Issue