Automattic\WooCommerce\Internal\Admin\Orders

PageController::setuppublicWC 1.0

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

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

Хуков нет.

Возвращает

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

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

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

Код PageController::setup() WC 10.3.4

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 ( empty( $plugin_page ) || '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 );
	$page_name   = ( \WC_Admin_Menus::can_view_woocommerce_menu_item() ? 'woocommerce_page_wc-orders' : 'admin_page_wc-orders' ) . $page_suffix;

	add_action( "load-{$page_name}", array( $this, 'handle_load_page_action' ) );
	add_action( 'admin_title', array( $this, 'set_page_title' ) );
}