# wp-graphql/trunk/src/Data/Loader/SettingGroupLoader.php

WPGraphQL, version trunk. 48 lines.

- Page: https://pluginprobe.com/plugins/wp-graphql/trunk/code/src/Data/Loader/SettingGroupLoader.php
- Raw: https://pluginprobe.com/plugins/wp-graphql/trunk/raw/src/Data/Loader/SettingGroupLoader.php
- Modified: 2026-07-23T17:41:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-graphql/trunk/code/src/Data/Loader/SettingGroupLoader.php#L10-L20`.

```php
<?php
namespace WPGraphQL\Data\Loader;

use WPGraphQL\Data\DataSource;
use WPGraphQL\Model\SettingGroup;

/**
 * Class SettingGroupLoader
 *
 * Loads settings groups (keyed by their normalized group key, e.g. "general",
 * "permalink") from the normalized settings map and returns them as
 * SettingGroup models.
 *
 * @package WPGraphQL\Data\Loader
 */
class SettingGroupLoader extends AbstractDataLoader {

	/**
	 * {@inheritDoc}
	 *
	 * @param array<string,array<string,mixed>> $entry The group's entries from the normalized settings map.
	 *
	 * @return \WPGraphQL\Model\SettingGroup
	 * @throws \Exception
	 */
	protected function get_model( $entry, $key ) {
		return new SettingGroup( (string) $key, $entry );
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string[] $keys Normalized settings group keys.
	 * @return array<string,array<string,array<string,mixed>>|null>
	 */
	public function loadKeys( array $keys ) {
		$groups = DataSource::get_allowed_settings_by_group( \WPGraphQL::get_type_registry() );

		$loaded = [];

		foreach ( $keys as $key ) {
			$loaded[ $key ] = ! empty( $groups[ $key ] ) ? $groups[ $key ] : null;
		}

		return $loaded;
	}
}

```
