/redaxo-yform:yform-tablesfrom redaxo-yform
Defines and manages YForm tables in REDAXO via Table Manager UI or programmatic install.php setup, including schema migrations, field configs, and tableset import/export.
Ships in redaxo-yform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
YForm extends REDAXO with custom database tables that get a backend UI (Table Manager) plus an ORM-style dataset API. A "table" in YForm = a real DB table + a configuration of fields/validators/relations stored in rex_yform_table and rex_yform_field.
install.php of an addon – idempotent, safe to commit, runs on every install/update.For production code, always use option 2.
| Option | Description |
|---|---|
prio | Sort position among tables in the menu |
table_name | MySQL table name (must include rex_ prefix) |
name | Backend menu label |
description | Documentation text shown to backend editors |
status | 1 = show in menu, 0 = hidden |
list_amount | Pagination – records per page (default 30) |
list_sortfield / list_sortorder | Default sort column and ASC / DESC |
search | Enable backend search field |
hidden | Hide from menu but keep API access |
export | Show export button |
import | Show import button |
history | Enable record versioning |
install.php<?php
// install.php
$table = rex_yform_manager_table::get(rex::getTable('team_member'));
// 1. Ensure the underlying SQL table exists with the right columns
rex_sql_table::get(rex::getTable('team_member'))
->ensurePrimaryIdColumn()
->ensureColumn(new rex_sql_column('name', 'varchar(255)', false, ''))
->ensureColumn(new rex_sql_column('email', 'varchar(255)', false, ''))
->ensureColumn(new rex_sql_column('role', 'varchar(64)', false, ''))
->ensureColumn(new rex_sql_column('photo', 'text', true))
->ensureColumn(new rex_sql_column('bio', 'text', true))
->ensureColumn(new rex_sql_column('status', 'tinyint(1)', false, '1'))
->ensureColumn(new rex_sql_column('createdate', 'datetime', false))
->ensureColumn(new rex_sql_column('updatedate', 'datetime', false))
->ensure();
// 2. Configure YForm metadata for the table
rex_yform_manager_table_api::setTable([
'table_name' => rex::getTable('team_member'),
'name' => 'Team members',
'list_amount' => 30,
'prio' => 1,
'hidden' => 0,
'status' => 1,
'export' => 1,
'import' => 1,
]);
// 3. Define fields (one entry per column the editor sees in the backend)
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'text',
'name' => 'name',
'label' => 'Name',
'prio' => 1,
]);
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'text',
'name' => 'email',
'label' => 'Email',
'prio' => 2,
]);
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'be_manager_relation',
'name' => 'role',
'label' => 'Role',
'table' => rex::getTable('team_role'),
'field' => 'name',
'type' => '0', // 0=single select, 1=multi select, 2=popup, 3=popup multi, 4=1:n popup, 5=1:n inline
'prio' => 3,
]);
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'be_media',
'name' => 'photo',
'label' => 'Photo',
'prio' => 4,
]);
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'textarea',
'name' => 'bio',
'label' => 'Bio',
'prio' => 5,
]);
// 4. Validation
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'validate',
'type_name' => 'empty',
'name' => 'name',
'message' => 'Please enter a name.',
'prio' => 100,
]);
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'validate',
'type_name' => 'type',
'name' => 'email',
'type_name_internal' => 'email',
'message' => 'Please enter a valid email address.',
'prio' => 101,
]);
update.phpAlways gate each schema change with a version check so reinstalls and partial upgrades stay correct.
<?php
// update.php
$installed = rex_addon::get('my_addon')->getVersion();
if (rex_version::compare($installed, '1.1.0', '<')) {
rex_sql_table::get(rex::getTable('team_member'))
->ensureColumn(new rex_sql_column('twitter', 'varchar(64)', true))
->ensure();
rex_yform_manager_table_api::setTableField(rex::getTable('team_member'), [
'type_id' => 'value',
'type_name' => 'text',
'name' => 'twitter',
'label' => 'Twitter handle',
'prio' => 6,
]);
}
Tablesets let you ship a table definition as JSON (Table Manager → Export). Useful for:
Structure:
{
"rex_team_member": {
"table": {
"status": 1,
"table_name": "rex_team_member",
"name": "Team members",
"list_amount": 30,
"search": 1,
"hidden": 0,
"export": 1,
"import": 0
},
"fields": [
{
"type_id": "value",
"type_name": "text",
"db_type": "varchar(255)",
"name": "name",
"label": "Name",
"list_hidden": 0,
"search": 1
}
]
}
}
For production projects, prefer programmatic definition in install.php over imported tablesets — tablesets aren't versioned with the rest of your code.
prio – fields appear in random order. Use ascending integers per topic block (1-99 = values, 100-199 = validators).rex_team_member instead of rex::getTable('team_member') – breaks multi-instance / non-default-prefix setups.rex_yform_manager_table_api::setTable() without a name key – on insert and on update it sets name to the table name, so a later call that only changes e.g. list_amount silently replaces the backend label. Pass name every time; other missing keys stay untouched.db_type to alter an existing column – generateTableAndFields() only re-ensures existing columns when the table has schema_overwrite = 1 (the column default for tables inserted via setTable(); migrateTable() defaults to 0). With 0 the field definition changes, the column keeps its old type.removeTablefield() keeps column and data. Only generateTableAndFields($table, true) (Table Manager button "Update table/s with field deletion") drops them, and it drops every column without a YForm field except id, including columns added on purpose via rex_sql_table.createdate / updatedate columns – YForm's standard datestamp fields silently break without them.value field – sort by prio so values come first, then validators.rex_yform_manager_table_api::setTableField() to create the column – setTable() itself creates a missing SQL table (CREATE TABLE IF NOT EXISTS with id) and the columns of fields that already exist, but a field added afterwards via setTableField() gets its column only after rex_yform_manager_table_api::generateTableAndFields() (or your own rex_sql_table::ensure()).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/yform-datasetsORM-style read/write on YForm tables using rex_yform_manager_dataset and the query builder (rex_yform_manager_query). Covers model classes, all where/join/select/order/group methods, relations, pagination via rex_pager, CRUD, dataset-driven forms, and SQL debugging. Use when the user reads or writes to a YForm table from PHP, builds custom backend lists, joins related tables, paginates, or queries datasets in frontend templates./yform-email-templatesYForm email templates – placeholder syntax, sending mails from forms via tpl2email, sending mails programmatically from PHP, attachments, and using REX_YFORM_DATA placeholders. Use when the user creates or edits a YForm email template, configures tpl2email actions, sends YForm-template-based emails outside a form (e.g. cronjob, callback), or troubleshoots placeholder substitution./yform-fieldsnpx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-yformOther plugins' skills for the same job