Automattic\WooCommerce\Internal\Admin\Settings
SettingsUISchema::assert_shell_breadcrumbs
Assert shell breadcrumbs.
Method of the class: SettingsUISchema{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = SettingsUISchema::assert_shell_breadcrumbs( $breadcrumbs ): void;
- $breadcrumbs(mixed) (required)
- Breadcrumb metadata, or null when omitted.
SettingsUISchema::assert_shell_breadcrumbs() SettingsUISchema::assert shell breadcrumbs code WC 11.2.1
private static function assert_shell_breadcrumbs( $breadcrumbs ): void {
if ( null === $breadcrumbs ) {
return;
}
if ( ! is_array( $breadcrumbs ) || ! ArrayUtil::array_is_list( $breadcrumbs ) ) {
throw self::invalid_schema( 'Shell breadcrumbs must be a list.' );
}
foreach ( $breadcrumbs as $index => $breadcrumb ) {
if ( ! is_array( $breadcrumb ) || ! isset( $breadcrumb['label'] ) || ! is_string( $breadcrumb['label'] ) ) {
throw self::invalid_schema( sprintf( 'Shell breadcrumb %d label must be a string.', $index ) );
}
if ( isset( $breadcrumb['href'] ) && ! is_string( $breadcrumb['href'] ) ) {
throw self::invalid_schema( sprintf( 'Shell breadcrumb %d href must be a string.', $index ) );
}
}
}