Add configurable column widths (full/half) and optional descriptions for radio/select/checkbox options on registration form fields. - Migration adds display_width column to both tables - FieldDisplayWidth enum with smart defaults per field type - normalized_options accessor for backwards-compatible option format - Portal form renderer uses display_width for VRow/VCol grid layout - Radio/select/checkbox options render with descriptions - Admin field editor supports display_width toggle and description input - System templates updated with appropriate widths and descriptions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
973 B
PHP
39 lines
973 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Enums;
|
|
|
|
enum FieldDisplayWidth: string
|
|
{
|
|
case FULL = 'full';
|
|
case HALF = 'half';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::FULL => 'Volledige breedte',
|
|
self::HALF => 'Halve breedte',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Return the default display width for a given field type.
|
|
*/
|
|
public static function defaultForFieldType(RegistrationFieldType $fieldType): self
|
|
{
|
|
return match ($fieldType) {
|
|
RegistrationFieldType::TEXT,
|
|
RegistrationFieldType::NUMBER,
|
|
RegistrationFieldType::SELECT,
|
|
RegistrationFieldType::BOOLEAN => self::HALF,
|
|
|
|
RegistrationFieldType::TEXTAREA,
|
|
RegistrationFieldType::RADIO,
|
|
RegistrationFieldType::CHECKBOX,
|
|
RegistrationFieldType::MULTISELECT,
|
|
RegistrationFieldType::TAG_PICKER => self::FULL,
|
|
};
|
|
}
|
|
}
|