Automattic\WooCommerce\Internal\Admin\Orders

PageController::get_base_page_url()publicWC 1.0

Helper method to generate a link to the main screen for a custom order type.

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

Хуков нет.

Возвращает

Строку.

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

$PageController = new PageController();
$PageController->get_base_page_url( $order_type ): string;
$order_type(строка) (обязательный)
The order type.

Код PageController::get_base_page_url() WC 8.7.0

public function get_base_page_url( $order_type ): string {
	$order_types_with_ui = wc_get_order_types( 'admin-menu' );

	if ( ! in_array( $order_type, $order_types_with_ui, true ) ) {
		// translators: %s is a custom order type.
		throw new \Exception( sprintf( __( 'Invalid order type: %s.', 'woocommerce' ), esc_html( $order_type ) ) );
	}

	return admin_url( 'admin.php?page=wc-orders' . ( 'shop_order' === $order_type ? '' : '--' . $order_type ) );
}