Automattic\WooCommerce\Internal\Admin\Settings

SettingsUIRequestContext::validate_script_handles │ private static │ WC 1.0

Validate extension script handle declarations.

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

Хуков нет.

Возвращает

string[]. Validated script handles.

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

$result = SettingsUIRequestContext::validate_script_handles( $script_handles ): array;
$script_handles(массив) (обязательный)
Declared script handles.

Код SettingsUIRequestContext::validate_script_handles() WC 11.2.2

private static function validate_script_handles( array $script_handles ): array {
	// Exception messages are cached diagnostics rather than HTML output. Dynamic
	// handles are sanitized before the exception crosses this boundary.
	// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
	foreach ( $script_handles as $script_handle ) {
		if ( ! is_string( $script_handle ) || '' === trim( $script_handle ) ) {
			throw new \InvalidArgumentException( __( 'Settings UI script handles must be non-empty strings.', 'woocommerce' ) );
		}
	}
	// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped

	return array_values( array_unique( array_map( 'trim', $script_handles ) ) );
}