Automattic\WooCommerce\Internal\Admin\Orders

PageController::setup()publicWC 1.0

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

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

Хуков нет.

Возвращает

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

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

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

Код PageController::setup() WC 9.5.1

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 );

	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' ) );
}