-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This guide describes how to create, edit, and apply form variants for a content type.
- Variant: A named layout definition for a node edit form (fields included, ordering, and grouping).
- Component: A field or extra form element (e.g., “Authoring information”, “Revision information”, module-provided widgets).
- Group: A simple fieldset-like container that holds child components and moves with them.
- Go to Administration → Structure → Content types.
- For the target content type, open the Variant forms page.
- Click Add variant.
- Enter:
- Label (human readable)
- Variant machine key (used in URL; keep stable)
- Save.
After creation, you will be taken to:
admin/structure/types/manage/%type/vforms/%variant/edit
On the variant edit page you can:
- Drag rows to reorder (fields and extra fields).
- Toggle whether a field is included in the variant.
- Save to persist the layout.
Notes:
- If you see “weights” instead of drag handles, switch back to drag mode (depending on the UI toggle provided on that screen).
- On the variant edit page, use Create group (header action).
- A group row appears in the table.
- The group name (fieldset anchor) may be typed into the group header.
- Drag fields into the group; grouped items become children of that group row.
- Drag the entire group row to reposition it; children move with it.
Each group header row contains an inline radio control:
-
closed
- Group is collapsible and initially collapsed.
-
open
- Group is collapsible and initially expanded.
-
locked open
- Group is always open and not collapsible.
This affects how the group is rendered on the actual node edit form.
You may intersperse grouped and ungrouped fields by adding additional ungrouped sections. These may be clicked up and down the list.
vforms adds a Views field that creates an Edit link targeting a specific form variant (optionally opening in a jQuery UI dialog).
- Edit your View (base table should be Content / Node).
- Add field
- Search for and add: Form variant edit link
(This is provided by vforms; it appears under the Node table fields.)
In the field settings you will see a Form variant settings fieldset:
-
Form variant
- If your View is restricted to a single content type (via a “Content: Type” filter),
this is a dropdown listing the variants available for that type (including
Default). - If your View can show multiple content types, the UI switches to:
- Form variant (global fallback) (text field, variant machine key)
- Variants per content type (optional per-type overrides)
- If your View is restricted to a single content type (via a “Content: Type” filter),
this is a dropdown listing the variants available for that type (including
-
Open in modal dialog
- When enabled, the link opens the node edit form (for the chosen variant) in a draggable, resizable dialog using Backdrop’s AJAX dialog.
-
Dialog width
- Width in pixels (only shown when modal is enabled).
The “Text to display” supports an icon placeholder:
- Leave it blank to display only a pencil icon.
- Use
%inside text to embed the icon, e.g.Edit % - Use either
\%or%%for a literal percent sign.
- The link respects node update access (it will not render if the user cannot edit the node).
- The link includes a
destinationquery so returning to the View after save/cancel works as expected. - Debugging: adding
?mf_debug=1to the page URL enables watchdog debug logging for variant detection in the Views handler.
How a variant is selected depends on your site workflow and how you link to forms. Common approaches:
- Use a dedicated URL that includes the variant key (if your site provides such routes).
- Provide an “Edit using variant” link (common when used with dialogs).
- Configure per-role or per-context logic (if implemented in your site build).
If your site uses the vforms dialog route, the editor opens in a jQuery UI dialog and updates the node form via AJAX.
Variants are stored as Backdrop config and can be moved between environments:
- Go to Administration → Configuration management
- Export active configuration (or use staging workflow)
- Look for config items like:
vforms.node.<bundle>
- Import on the target site.
Tip (SQL lookup):
SELECT name FROM config WHERE name LIKE 'vforms.%';