protected function get_pack_data( DirectoryIterator $pack_dir ) {
		$pack_dirname  = $pack_dir->getFilename();
		$pack_path     = $pack_dir->getPathname();
		$cache_id      = "icon_picker_fontpack_{$pack_dirname}";
		$cache_data    = get_transient( $cache_id );
		$config_file   = "{$pack_path}/config.json";

		if ( false !== $cache_data && $cache_data['version'] === $pack_dir->getMTime() ) {
			return $cache_data;
		}

		// Make sure the config file exists and is readable.
		if ( ! is_readable( $config_file ) ) {
			trigger_error(
				sprintf(
					esc_html( $this->messages['no_config'] ),
					'<code>config.json</code>',
					sprintf( '<code>%s</code>', esc_html( $pack_path ) )
				)
			);

			return false;
		}

		$config = json_decode( file_get_contents( $config_file ), true );
		$errors = json_last_error();

		if ( ! empty( $errors ) ) {
			trigger_error(
				sprintf(
					esc_html( $this->messages['config_error'] ),
					sprintf( '<code>%s/config.json</code>', esc_html( $pack_path ) )
				)
			);

			return false;
		}

		$keys   = array( 'name', 'glyphs', 'css_prefix_text' );
		$items  = array();

		// Check each required config.
		foreach ( $keys as $key ) {
			if ( empty( $config[ $key ] ) ) {
				trigger_error(
					sprintf(
						esc_html( $this->messages['invalid'] ),
						sprintf( '<code><em>%s</em></code>', esc_html( $key ) ),
						esc_html( $config_file )
					)
				);

				return false;
			}
		}

		// Bail if no glyphs found.
		if ( ! is_array( $config['glyphs'] ) || empty( $config['glyphs'] ) ) {
			return false;
		}

		foreach ( $config['glyphs'] as $glyph ) {
			if ( ! empty( $glyph['css'] ) ) {
				$items[] = array(
					'id'   => $config['css_prefix_text'] . $glyph['css'],
					'name' => $glyph['css'],
				);
			}
		}

		if ( empty( $items ) ) {
			return false;
		}

		$pack_data = array(
			'id'             => "pack-{$config['name']}",
			'name'           => sprintf( __( 'Pack: %s', 'icon-picker' ), $config['name'] ),
			'version'        => $pack_dir->getMTime(),
			'items'          => $items,
			'stylesheet_uri' => "{$this->url}/{$pack_dirname}/css/{$config['name']}.css",
			'dir'            => "{$this->dir}/{$pack_dirname}",
			'url'            => "{$this->url}/{$pack_dirname}",
		);

		set_transient( $cache_id, $pack_data, DAY_IN_SECONDS );

		return $pack_data;
	}