# blocks/trunk/src/Settings/FieldDefinition.php

Blocks – Reusable Content, Shortcodes &amp; Site Variables, version trunk. 37 lines.

- Page: https://pluginprobe.com/plugins/blocks/trunk/code/src/Settings/FieldDefinition.php
- Raw: https://pluginprobe.com/plugins/blocks/trunk/raw/src/Settings/FieldDefinition.php
- Modified: 2026-08-08T04:05:00+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/blocks/trunk/code/src/Settings/FieldDefinition.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace RenzoJohnson\Blocks\Settings;

\defined( 'ABSPATH' ) || exit;

final class FieldDefinition {
	/**
	 * @param non-empty-list<SettingDefinition> $settings
	 * @param array<string, mixed>               $render_args
	 * @throws \InvalidArgumentException When no setting is supplied.
	 */
	public function __construct(
		public readonly string $id,
		public readonly string $label,
		public readonly string $description,
		public readonly FieldType $type,
		public readonly array $settings,
		public readonly array $render_args = array(),
		public readonly Requirement $requirement = Requirement::Always,
		// Descriptions are hard-escaped, so a documentation link is carried as
		// data and rendered as its own anchor rather than as inline markup.
		public readonly string $doc_url = '',
		public readonly string $doc_label = '',
	) {
		if ( array() === $settings ) {
			throw new \InvalidArgumentException( 'A field must own at least one setting.' );
		}
	}

	public function primary(): SettingDefinition {
		return $this->settings[0];
	}
}

```
