Skip to content

Commit 4f2d7ac

Browse files
committed
fix: correct field type data mappings in documentation
Fix incorrect data storage columns and data types in SKILL.md and field-types.md to match actual 2.x codebase definitions.
1 parent 224737a commit 4f2d7ac

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

docs/content/2.essentials/3.field-types.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Custom Fields includes 20+ pre-configured field types:
1313

1414
| Field Type | Key | Data Type | Description |
1515
|------------|-----|-----------|-------------|
16-
| **Text Input** | `text` | String | Basic text input with validation |
16+
| **Text Input** | `text` | Text | Basic text input with validation |
1717
| **Email** | `email` | String | Email input with validation |
1818
| **Phone** | `phone` | String | Phone number input |
19-
| **Link** | `link` | String | URL validation and formatting |
19+
| **Link** | `link` | Text | URL validation and formatting |
2020
| **Textarea** | `textarea` | Text | Multi-line text input |
2121
| **Rich Editor** | `rich-editor` | Text | WYSIWYG editor with formatting |
2222
| **Markdown Editor** | `markdown-editor` | Text | Markdown syntax with preview |
@@ -31,8 +31,8 @@ Custom Fields includes 20+ pre-configured field types:
3131
| **Toggle** | `toggle` | Boolean | Switch-style toggle |
3232
| **Toggle Buttons** | `toggle-buttons` | Single-choice | Button group selection |
3333
| **Date** | `date` | Date | Date picker |
34-
| **Date Time** | `datetime` | DateTime | Date and time picker |
35-
| **Color Picker** | `color-picker` | String | Visual color selection |
34+
| **Date Time** | `date-time` | DateTime | Date and time picker |
35+
| **Color Picker** | `color-picker` | Text | Visual color selection |
3636
| **File Upload** | `file-upload` | String | File upload with validation |
3737

3838
## Creating Custom Field Types
@@ -77,7 +77,7 @@ class StarRatingFieldType extends BaseFieldType
7777
public function configure(): FieldSchema
7878
{
7979
return FieldSchema::numeric()
80-
->key('star-rating')
80+
->key('acme-star-rating')
8181
->label('Star Rating')
8282
->icon('heroicon-o-star')
8383
->formComponent(function (CustomField $customField) {
@@ -291,11 +291,12 @@ enum FieldDataType: string
291291
## Best Practices
292292

293293
1. **Use Existing Filament Components**: Build on Filament's components like `Select`, `TextInput`, etc.
294-
2. **Follow Naming Conventions**: Use kebab-case for keys (e.g., `star-rating`, `country-select`)
295-
3. **Choose the Right Data Type**: Select the data type that matches how your field's values should be stored
296-
4. **Use Closures for Flexibility**: For complex components, use closure-based definitions
297-
5. **Test Your Components**: Ensure your field type works in forms, tables, and infolists
298-
6. **Consider Validation**: Only allow validation rules that make sense for your field type
294+
2. **Follow Naming Conventions**: Use kebab-case for keys (e.g., `acme-star-rating`, `myapp-country-select`)
295+
3. **Prefix Keys with Project/Org Name**: Always prefix custom field type keys with your project or organization name to avoid conflicts with built-in types (e.g., `acme-priority` instead of `priority`)
296+
4. **Choose the Right Data Type**: Select the data type that matches how your field's values should be stored
297+
5. **Use Closures for Flexibility**: For complex components, use closure-based definitions
298+
6. **Test Your Components**: Ensure your field type works in forms, tables, and infolists
299+
7. **Consider Validation**: Only allow validation rules that make sense for your field type
299300

300301
## Field Type Priority
301302

resources/boost/skills/custom-fields-development/SKILL.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,27 +138,36 @@ public function getColumns(): array
138138

139139
| Type | Key | Data Storage |
140140
|------|-----|--------------|
141-
| Text | `text` | string_value |
141+
| Text | `text` | text_value |
142142
| Email | `email` | string_value |
143143
| Phone | `phone` | string_value |
144144
| Textarea | `textarea` | text_value |
145145
| Rich Editor | `rich-editor` | text_value |
146146
| Markdown | `markdown-editor` | text_value |
147-
| Link | `link` | string_value |
147+
| Link | `link` | text_value |
148148
| Number | `number` | integer_value |
149149
| Currency | `currency` | float_value |
150150
| Date | `date` | date_value |
151-
| DateTime | `datetime` | datetime_value |
152-
| Select | `select` | string_value |
151+
| DateTime | `date-time` | datetime_value |
152+
| Select | `select` | integer_value |
153153
| Multi-Select | `multi-select` | json_value |
154154
| Checkbox | `checkbox` | boolean_value |
155155
| Checkbox List | `checkbox-list` | json_value |
156-
| Radio | `radio` | string_value |
156+
| Radio | `radio` | integer_value |
157157
| Toggle | `toggle` | boolean_value |
158-
| Toggle Buttons | `toggle-buttons` | string_value |
158+
| Toggle Buttons | `toggle-buttons` | integer_value |
159159
| Tags Input | `tags-input` | json_value |
160-
| Color Picker | `color-picker` | string_value |
161-
| File Upload | `file-upload` | json_value |
160+
| Color Picker | `color-picker` | text_value |
161+
| File Upload | `file-upload` | string_value |
162+
163+
### Field Type Key Naming
164+
165+
When creating custom field types, prefix keys with your project/organization name to avoid conflicts:
166+
167+
- Use `acme-star-rating` instead of `star-rating`
168+
- Use `myapp-priority` instead of `priority`
169+
170+
This prevents collisions if built-in field types are added later with similar names.
162171

163172
## Feature Flags
164173

0 commit comments

Comments
 (0)