Field type reference
The Brezel 4 (feat/ai) registry contains 38 field types. month, client and relation are not registered field types. Use select or multiselect for relations.
- Text and number fields:
text,textarea,wysiwyg,code,email,tel,link,password,number,currency,range,rating - Choice and relation fields:
checkbox,choice,select,multiselect - Date and time fields:
date,datetime,dateRange,time,week - File and media fields:
file,upload,directory,signature - Structured fields: list, JSON, map, address and location:
list,json,map,address,location - Special fields: identifiers, modules and appearance:
barcode,color,icon,uniqid,incrementing,module,field,layout - Common field options: rules, recipes, events, permissions, export and import.
Field definitions belong in a module’s fields array. The top-level keys are identifier, type (default text), configKey (defaults to identifier), description, position, table_position, recipe, and options. id is computed. Position defaults to the array index.
options must be an object. Put required validation in options.rules, labels in options.label, and a calculated value in top-level recipe. Top-level required and label, and options.recipe, are rejected by authoring validation.
Database columns and MySQL limits
Section titled “Database columns and MySQL limits”Each module has a table resource_<module>. Most fields are a column in it (Field::defineColumns):
| Field types | Column | Counts toward row size |
|---|---|---|
text, email, tel, choice, range, uniqid, color, week (and unknown types) | varchar(300) | up to 1,202 bytes (utf8mb4) |
link | varchar(2048) | about 8 KB |
textarea, wysiwyg, code, signature, layout | longtext | stored off-row, a few bytes only |
json, map, address, dateRange | json | stored off-row, a few bytes only |
list, select, multiselect, file, upload, directory | no column, separate table | — |
MySQL limits a row to 65,535 bytes. About 54 text fields, or 7 link fields, already use that up. On wide modules (shop orders with many address, tracking and invoice fields), bakery:apply then fails with Row size too large. Recommendations:
- For values that are not filtered or sorted, use
textareaorjsoninstead oftext/link. - Group related values in a
jsonorlistfield instead of adding manytextfields. - If you change a column to
TEXTmanually in the database, a later change to the field’s options can change it back tovarchar. Brezel re-alters the column from the field type. Change the field type in the bakery resource instead, or document the manual change.
MySQL identifiers (table, column, index and foreign key names) can be up to 64 characters. See list for list tables.
A failed bakery:apply is not rolled back. See Applying planned changes.
Source: API app/Field.php::$types, field subclasses and BakeryResourceModule::getFieldSchemaFactory; SPA src/layout/fields and field widgets.