Automattic\WooCommerce\Internal\Admin\Settings

SettingsUIRequestContext::ensure_drill_down_breadcrumbs │ private │ WC 1.0

Ensure a drill-down schema carries breadcrumbs back to its parent tab.

Schemas that omit shell.breadcrumbs get a single crumb linking to the parent settings tab, since the header breadcrumbs replace the top-level settings tabs on drill-down pages.

Method of the class: SettingsUIRequestContext{}

No Hooks.

Returns

array.

Usage

// private - for code of main (parent) class only
$result = $this->ensure_drill_down_breadcrumbs( $schema ): array;
$schema(array) (required)
Resolved settings UI schema.

SettingsUIRequestContext::ensure_drill_down_breadcrumbs() code WC 11.1.2

private function ensure_drill_down_breadcrumbs( array $schema ): array {
	if ( ! $this->is_drill_down() || isset( $schema['shell']['breadcrumbs'] ) ) {
		return $schema;
	}

	$schema['shell']['breadcrumbs'] = array(
		array(
			'label' => wp_strip_all_tags( html_entity_decode( $this->settings_page->get_label(), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ),
			'href'  => add_query_arg(
				array(
					'page' => 'wc-settings',
					'tab'  => sanitize_title( $this->settings_page->get_id() ),
				),
				admin_url( 'admin.php' )
			),
		),
	);

	return $schema;
}