Automattic\WooCommerce\Internal\Admin\Orders

PageController::setup()publicWC 1.0

Sets up the page controller, including registering the menu item.

Method of the class: PageController{}

No Hooks.

Return

null. Nothing (null).

Usage

$PageController = new PageController();
$PageController->setup(): void;

PageController::setup() code WC 8.7.0

public function setup(): void {
	global $plugin_page, $pagenow;

	$this->redirection_controller = new PostsRedirectionController( $this );

	// Register menu.
	if ( 'admin_menu' === current_action() ) {
		$this->register_menu();
	} else {
		add_action( 'admin_menu', 'register_menu', 9 );
	}

	// Not on an Orders page.
	if ( 'admin.php' !== $pagenow || 0 !== strpos( $plugin_page, 'wc-orders' ) ) {
		return;
	}

	$this->set_order_type();
	$this->set_action();

	$page_suffix = ( 'shop_order' === $this->order_type ? '' : '--' . $this->order_type );

	self::add_action( 'load-woocommerce_page_wc-orders' . $page_suffix, array( $this, 'handle_load_page_action' ) );
	self::add_action( 'admin_title', array( $this, 'set_page_title' ) );
}