Automattic\WooCommerce\Internal\Admin\Settings
SettingsUISchema::assert_shell
Assert shell metadata.
Method of the class: SettingsUISchema{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = SettingsUISchema::assert_shell( $shell ): void;
- $shell(mixed) (required)
- Shell metadata, or null when omitted.
SettingsUISchema::assert_shell() SettingsUISchema::assert shell code WC 11.2.1
private static function assert_shell( $shell ): void {
if ( null === $shell ) {
return;
}
if ( ! is_array( $shell ) ) {
throw self::invalid_schema( 'Schema shell must be an array.' );
}
self::assert_optional_strings( $shell, array( 'title', 'subtitle' ), 'Shell' );
if ( isset( $shell['header'] ) && ! in_array( $shell['header'], array( 'hidden', 'visible' ), true ) ) {
throw self::invalid_schema( 'Shell header must be "hidden" or "visible".' );
}
if ( array_key_exists( 'navigationComponent', $shell ) ) {
self::assert_non_empty_string( $shell['navigationComponent'], 'Shell navigationComponent must be a non-empty string.' );
}
foreach ( array( 'navigation', 'sectionNavigation' ) as $property ) {
if ( ! array_key_exists( $property, $shell ) ) {
continue;
}
self::assert_shell_navigation( $shell[ $property ], 'Shell ' . $property );
}
self::assert_shell_breadcrumbs( $shell['breadcrumbs'] ?? null );
self::assert_shell_badges( $shell['badges'] ?? null );
}