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/wpgraphql-acf/src/Data/Loader/AcfOptionsPageLoader.php
<?php
namespace WPGraphQL\Acf\Data\Loader;

use WPGraphQL\Acf\Utils;
use WPGraphQL\Data\Loader\AbstractDataLoader;

class AcfOptionsPageLoader extends AbstractDataLoader {

	/**
	 * @param array<mixed> $keys
	 *
	 * @return array<mixed>
	 * @throws \Exception
	 */
	protected function loadKeys( array $keys ): array {
		if ( empty( $keys ) ) {
			return [];
		}

		$options_pages = Utils::get_acf_options_pages();

		if ( empty( $options_pages ) ) {
			return [];
		}

		$response = [];

		foreach ( $keys as $key ) {
			if ( isset( $options_pages[ $key ] ) ) {
				$response[ $key ] = new \WPGraphQL\Acf\Model\AcfOptionsPage( $options_pages[ $key ] );
			}
		}

		return $response;
	}
}