HEX
Server: Apache/2.4.66 (Debian)
System: Linux 6dfabc3b2241 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: (1000)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-graphql/src/Data/Loader/EnqueuedScriptLoader.php
<?php
namespace WPGraphQL\Data\Loader;

/**
 * Class EnqueuedScriptLoader
 *
 * @package WPGraphQL\Data\Loader
 */
class EnqueuedScriptLoader extends AbstractDataLoader {

	/**
	 * {@inheritDoc}
	 *
	 * @param string[] $keys Array of script handles to load
	 *
	 * @return array<string,mixed>
	 */
	public function loadKeys( array $keys ) {
		/** @var \WP_Scripts $wp_scripts */
		global $wp_scripts;

		$loaded = [];
		foreach ( $keys as $key ) {
			if ( isset( $wp_scripts->registered[ $key ] ) ) {
				$script         = $wp_scripts->registered[ $key ];
				$script->type   = 'EnqueuedScript';
				$loaded[ $key ] = $script;
			} else {
				$loaded[ $key ] = null;
			}
		}
		return $loaded;
	}
}