Automattic\WooCommerce\Internal\Admin\Orders

Edit::setup()publicWC 1.0

Setup hooks, actions and variables needed to render order edit page.

Метод класса: Edit{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$Edit = new Edit();
$Edit->setup( $order );
$order(\WC_Order) (обязательный)
Order object.

Код Edit::setup() WC 9.5.1

public function setup( \WC_Order $order ) {
	$this->order    = $order;
	$current_screen = get_current_screen();
	$current_screen->is_block_editor( false );
	$this->screen_id = $current_screen->id;
	if ( ! isset( $this->custom_meta_box ) ) {
		$this->custom_meta_box = wc_get_container()->get( CustomMetaBox::class );
	}

	if ( ! isset( $this->taxonomies_meta_box ) ) {
		$this->taxonomies_meta_box = wc_get_container()->get( TaxonomiesMetaBox::class );
	}

	$this->add_save_meta_boxes();
	$this->handle_order_update();
	$this->add_order_meta_boxes( $this->screen_id, __( 'Order', 'woocommerce' ) );
	$this->add_order_specific_meta_box();
	$this->add_order_taxonomies_meta_box();

	/**
	 * From wp-admin/includes/meta-boxes.php.
	 *
	 * Fires after all built-in meta boxes have been added. Custom metaboxes may be enqueued here.
	 *
	 * Note that the documentation for this hook (and for the corresponding 'add_meta_boxes_<SCREEN_ID>' hook)
	 * suggest that a post type will be supplied for the first parameter, and and an instance of WP_Post will be
	 * supplied as the second parameter. We are not doing that here, however WordPress itself also deviates from
	 * this in respect of comments and (though now less relevant) links.
	 *
	 * @since 3.8.0.
	 */
	do_action( 'add_meta_boxes', $this->screen_id, $this->order );

	/**
	 * Provides an opportunity to inject custom meta boxes into the order editor screen. This
	 * hook is an analog of `add_meta_boxes_<POST_TYPE>` as provided by WordPress core.
	 *
	 * @since 7.4.0
	 *
	 * @param WC_Order $order The order being edited.
	 */
	do_action( 'add_meta_boxes_' . $this->screen_id, $this->order );

	$this->enqueue_scripts();
}