Fields
Fields define the nature and behavior of your content data. Each field corresponds to a specific data type (text, number, media, relation, etc.) and maps directly to a strict SQL column.
Native Fields
Pragma CMS includes a comprehensive suite of native fields, designed to handle 99% of web development needs out-of-the-box.
- Text : Simple single-line text input.
- Slug : URL-friendly formatted text (removes spaces and special characters automatically).
- Textarea : Multi-line text area.
- Wysiwyg : Rich visual editor (HTML generation).
- Icon : Icon selector (Material Symbols by default).
- Developer Note: The icon system is fully extensible. You can add custom icon libraries (FontAwesome, Lucide, etc.) without modifying the core CMS, thanks to the provider-based architecture and CMS hooks. See the Hooks documentation → Icon for implementation details.
- Number : Numeric field with strict validation.
- Rating : Simple rating input (e.g., 1 to 5 stars).
- Date: Native date picker.
- DateTime: Combined date and time input.
- Date Range: Start and end date interval.
- Time Range: Time interval.
- Duration: Duration input (e.g., hours/minutes).
- Checkbox: Classic boolean toggle.
- Toggle: Modern UI switch for boolean values.
- Radio: Single-choice radio buttons.
- Select: Dropdown list (single choice).
- Multi Select: Multiple choice selection with search capabilities.
- Relation : Hard link to another entry (Foreign Key behavior). It automatically fetches connected content titles for the UI and IDs for the database.
- Repeater : A dynamic, repeatable list of sub-fields. You can nest almost any native field inside a Repeater (Text, Media, Relation, Select, etc.). Repeaters are automatically compressed into a single JSON array in the database for maximum read/write performance.
- Media : General media upload (images, videos, or documents).
- Image : Strictly single image upload.
- Document : Strictly file/document upload.
- Video : Video upload or embedding.
- Gallery : A dedicated collection of images.
- Developer Note: The Gallery field is heavily extensible. You can use the
render_gallery_item_fieldshook to add custom inputs (like "Category" or "Photographer") to each image within the gallery interface. See the Hooks documentation → Gallery for implementation details.
- Developer Note: The Gallery field is heavily extensible. You can use the
- File: Generic file upload. In the admin, it opens the Media Library without filters. In public forms, it generates a standard file upload input.
- Embed (YouTube, etc.) : Embedding a video or external content via a URL.
- URL : Validated web address.
- Email : Validated email address.
- Phone : Simple phone number formatting.
- Color : Native HTML5 color picker.
- Location : Simple geographical coordinates.
- Location Map : Interactive map selector.
- Password : Masked, auto-hashed password field.
- Consent Checkbox : GDPR-compliant consent checkbox.
- JSON Editor : Advanced JSON editor with strict validation formatting.
- Composite: A fixed group of fields (e.g., an "Address" composite containing Street, City, and Zip Code).
- Visual Builder (Blocks): The powerful block-based editor (Editor.js) allowing freeform layout creation.
- Hidden: Field hidden from the user, useful for passing system data.
- Status: Displays the current status of the entry (Draft, Published, etc.).
- HTML / Separator: Visual separator or instructions in the admin form (does not create a database column).
- Conditional: Field with dynamic display logic based on other fields' values.
Custom Fields
The field system is designed to be fully decoupled. If your project requires a specific data type (like a Color Picker, a Google Maps selector, or an Inventory manager), you can register custom fields without modifying the core.
By using the CMS Hook system, you can define:
- Storage: How the data is written to SQL.
- UI: How the field looks in the Admin area.
- Processing: How data is sanitized and hydrated.
Developer Note
To learn how to implement your own fields, check out the Custom Fields API in the Hooks Reference.