Automattic\WooCommerce\Internal\Admin\Orders

PageController::set_page_title()privateWC 1.0

Set the document title for Orders screens to match what it would be with the shop_order CPT.

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

Хуков нет.

Возвращает

Строку. The filtered admin title.

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

// private - только в коде основоного (родительского) класса
$result = $this->set_page_title( $admin_title );
$admin_title(строка) (обязательный)
The admin screen title before it's filtered.

Код PageController::set_page_title() WC 8.1.1

private function set_page_title( $admin_title ) {
	if ( ! $this->is_order_screen( $this->order_type ) ) {
		return $admin_title;
	}

	$wp_order_type = get_post_type_object( $this->order_type );
	$labels        = get_post_type_labels( $wp_order_type );

	if ( $this->is_order_screen( $this->order_type, 'list' ) ) {
		$admin_title = sprintf(
			// translators: 1: The label for an order type 2: The name of the website.
			esc_html__( '%1$s ‹ %2$s — WordPress', 'woocommerce' ),
			esc_html( $labels->name ),
			esc_html( get_bloginfo( 'name' ) )
		);
	} elseif ( $this->is_order_screen( $this->order_type, 'edit' ) ) {
		$admin_title = sprintf(
			// translators: 1: The label for an order type 2: The title of the order 3: The name of the website.
			esc_html__( '%1$s #%2$s ‹ %3$s — WordPress', 'woocommerce' ),
			esc_html( $labels->edit_item ),
			absint( $this->order->get_id() ),
			esc_html( get_bloginfo( 'name' ) )
		);
	} elseif ( $this->is_order_screen( $this->order_type, 'new' ) ) {
		$admin_title = sprintf(
			// translators: 1: The label for an order type 2: The name of the website.
			esc_html__( '%1$s ‹ %2$s — WordPress', 'woocommerce' ),
			esc_html( $labels->add_new_item ),
			esc_html( get_bloginfo( 'name' ) )
		);
	}

	return $admin_title;
}