XMLView Overview
XMLViews are XML files that define how data is displayed and edited. They support:- Automatic form generation from model properties
- Data validation and input widgets
- Responsive grid layouts
- List views with sorting and filtering
- Edit views with tabs and groups
- Custom business logic integration
Plugins/YourPlugin/XMLView/
View Types
List Views
Display multiple records in a table with search and filters. Naming:ListModelName.xml
Example: ListProduct.xml
Edit Views
Display and edit a single record. Naming:EditModelName.xml
Example: EditProduct.xml
Creating a List View
CreateXMLView/ListMyModel.xml:
Column Attributes
| Attribute | Values | Description |
|---|---|---|
name | string | Translation key for column header |
display | left, center, right, none | Column visibility and alignment |
order | integer | Display order (lower = left) |
numcolumns | 1-12 | Width in grid (default: auto) |
description | string | Additional translation key for tooltip |
Creating an Edit View
CreateXMLView/EditMyModel.xml:
Group Element
Groups organize fields into sections:name- Translation key for group headernumcolumns- Total columns in grid (typically 12)title- Optional override for group headericon- FontAwesome icon class
Widget Types
FacturaScripts provides many widget types for different data:Text Input
maxlength- Maximum charactersrequired- Mark as requiredreadonly- Make read-onlyicon- FontAwesome iconhint- Placeholder text
Number Input
decimal- Number of decimal placesmin- Minimum valuemax- Maximum valuestep- Increment step
Textarea
rows- Number of visible rows
Checkbox
Date and Time
Select Dropdown
source- Model to load data fromfieldcode- Field to use as option valuefieldtitle- Field to use as option label
Autocomplete
onclick attribute enables editing the selected record.
Color Picker
File Upload
maxsize- Maximum file size in MBaccept- Accepted file types (e.g., “image/*”, “.pdf”)
Radio Buttons
HTML Editor
Advanced Features
Readonly Behavior
Thereadonly attribute supports:
Required Fields
Field Dependencies
parent attribute filters values based on another field’s value.
Click Actions
Title URLs
Rows Section
Define custom rows with statistics, actions, or custom content:Statistics Row
Displays calculated data:function attribute calls a method on your model:
Actions Row
Custom action buttons:primary- Bluesecondary- Graysuccess- Greendanger- Redwarning- Orangeinfo- Light blue
Complete Example
Here’s a complete edit view with multiple groups and widget types:Using XMLViews in Controllers
FacturaScripts has specialized controller types that automatically use XMLViews:ListController
For list pages:EditController
For edit pages:EditController automatically:
- Loads the XMLView from
XMLView/EditMyModel.xml - Handles form submission
- Performs validation
- Shows success/error messages
- Manages database operations
Custom Twig Templates
For complete custom control, create Twig templates inView/:
Best Practices
Use XMLViews
Prefer XMLViews over custom HTML for consistency
Group Related Fields
Organize fields into logical groups
Set Proper Order
Use order attributes to control field sequence
Add Icons
Use FontAwesome icons for visual clarity
Next Steps
Controllers
Create controllers to use your views
Models
Define data models
Creating Plugins
Back to plugin basics

