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

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

- Page: https://pluginprobe.com/plugins/blocks/trunk/code/src/Settings/SettingDefinition.php
- Raw: https://pluginprobe.com/plugins/blocks/trunk/raw/src/Settings/SettingDefinition.php
- Modified: 2026-07-13T20:34:48+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/SettingDefinition.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace RenzoJohnson\Blocks\Settings;

\defined( 'ABSPATH' ) || exit;

final class SettingDefinition {
	/** @throws \InvalidArgumentException When security or naming invariants are violated. */
	public function __construct(
		public readonly string $option_name,
		public readonly string $wp_type,
		public readonly bool|int|string $default_value,
		public readonly SanitizerType $sanitizer,
		public readonly bool $sensitive = false,
		public readonly bool $exportable = true,
		public readonly ?string $public_token = null,
	) {
		if ( ! \str_starts_with( $option_name, 'blocks_' ) ) {
			throw new \InvalidArgumentException( 'Blocks setting names must use the blocks_ prefix.' );
		}

		if ( $sensitive && ( $exportable || null !== $public_token ) ) {
			throw new \InvalidArgumentException( 'Sensitive settings cannot be exported or public tokens.' );
		}

		if ( PublicTokenRegistry::for_option( $option_name ) !== $public_token ) {
			throw new \InvalidArgumentException( 'Setting token metadata does not match the public token registry.' );
		}
	}
}

```
