Skip to content

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.

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.

Each module has a table resource_<module>. Most fields are a column in it (Field::defineColumns):

Field typesColumnCounts toward row size
text, email, tel, choice, range, uniqid, color, week (and unknown types)varchar(300)up to 1,202 bytes (utf8mb4)
linkvarchar(2048)about 8 KB
textarea, wysiwyg, code, signature, layoutlongtextstored off-row, a few bytes only
json, map, address, dateRangejsonstored off-row, a few bytes only
list, select, multiselect, file, upload, directoryno 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 textarea or json instead of text/link.
  • Group related values in a json or list field instead of adding many text fields.
  • If you change a column to TEXT manually in the database, a later change to the field’s options can change it back to varchar. 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.