$key, 'control' => $control, 'label' => $label, 'default' => $default, 'sanitize' => $sanitize, ], $extra); } public static function fixed(string $key, $value): array { return ['key' => $key, 'control' => null, 'value' => $value]; } /** * A value that follows from the other settings (for example the default of a list is its first choice). * * @param callable $derive fn(array $sanitizedSoFar, array $raw) */ public static function derived(string $key, callable $derive): array { return ['key' => $key, 'control' => null, 'derive' => $derive]; } public static function label(): array { return self::make('field_label', 'text', __('Field label', 'admin-options-pages'), 'text'); } public static function name(): array { return self::make('field_name', 'text', __('Field name', 'admin-options-pages'), 'field_name'); } public static function autoload(): array { return self::make('toggle_autoload', 'toggle', __('Autoload', 'admin-options-pages'), 'toggle_autoload', 'yes'); } /** * Whether the value may be shown through the shortcode and the block bindings: "yes" or "no". A field that was * stored without this key (made before 1.0) counts as "no". get_option() works for every field either way. * * @since 1.0.0 */ public static function frontend(): array { return self::make('frontend', 'toggle', __('Use in shortcode and blocks', 'admin-options-pages'), 'toggle_frontend', 'yes'); } public static function classAttribute(): array { return self::make('class_attribute', 'text', __('Additional CSS Class(es)', 'admin-options-pages'), 'class_attribute'); } public static function description(): array { return self::make('description', 'textarea', __('Description', 'admin-options-pages'), 'textarea'); } public static function defaultText(): array { return self::make('default_value', 'text', __('Default value', 'admin-options-pages'), 'text'); } public static function text(string $key, string $label): array { return self::make($key, 'text', $label, 'text'); } }