Schema-defined structured content in a single ProcessWire field.
Define objects, typed repeatable blocks, and editable tables in PHP or JSON — version-controlled in Git, rendered with native ProcessWire Inputfields, and stored without extra Repeater pages or separate fields. Read values through the familiar ProcessWire API and query them with standard selectors.
Page Editor Demo Video:
https://github.com/user-attachments/assets/072eab91-bc88-40c2-9f3d-c1ce2b999d81
Building blocks
Combine four composable structures inside a single Flex field:
| Structure | What it gives you |
|---|---|
| Native inputs | Regular ProcessWire Inputfields (TinyMCE, Images, Files, Page references, Multilingual, conditional showIf/requiredIf) with familiar settings. |
| Objects | Fixed, nested property groups that keep related values together without creating separate ProcessWire fields. |
| Rows | Repeatable, typed, and nestable content blocks with dynamic titles — no extra Repeater pages required. |
| Tables | Fixed columns with inline editing, optional editable headings and row labels, column sorting, and expandable detail rows for rich text, images, files, and page trees. |
Features
Schema as code & developer experience
- Git-friendly definitions. Author schemas in PHP, JSON, or native
InputfieldWrapperobjects — with reusable parts, page-aware logic, andinheritFieldto reuse existing field settings. - IDE autocompletion. Generate ready-to-use PHPDoc class stubs directly from the field settings (or programmatically via
getPhpDoc()). - Safe schema evolution. Unknown properties survive normal saves, and
renamedFromplus built-in maintenance tools handle renames and cleanup without data loss.
Native editor experience
- Feels like core ProcessWire. Uses native ProcessWire Inputfields, editor layouts, and scoped dependencies (
parent.,root.,page.,forpage.). Also works inside native ProcessWire Repeaters. - Copy, paste, and bulk actions. Copy and paste single or multiple rows — even across different ProcessWire installations, with automatic resolution of Page references, language values, and media. Select multiple rows to copy, hide, or mark them for removal in one step.
- Smooth row & table workflows. Add, duplicate, hide, reorder via drag-and-drop, and sort tables manually from column headers or automatically on save (
sortOnSave).
Media, languages & querying
- First-class files and images. Returns ProcessWire-compatible
PagefileandPageimageobjects with resizing and per-file custom metadata fields. New uploads keep the cleaned filename when it is available. Optional overwrite updates an existing file at the same URL immediately. - Multilingual & Language Alternates. Supports ProcessWire's native multilingual inputs as well as sibling Language Alternate fields (such as
imageandimage_de) with automatic fallback. - Full ProcessWire selectors. Find pages by properties inside Objects, Rows, and Tables — including nested values, block types, and row counts.
Quick start
Let's build a content field with an introduction and two repeatable block types: Text and Gallery.
1. Define the schema
Create a Flex field named content, add it to your template (with InputfieldTinyMCE installed), and save this definition as site/templates/flex-fields/content.php:
<?php namespace ProcessWire;
return [
'intro' => [
'type' => 'TinyMCE',
'label' => 'Introduction',
],
'blocks' => [
'type' => 'rows',
'label' => 'Content blocks',
'types' => [
'text' => [
'label' => 'Text',
// Dynamic row header with fallback value
'rowTitle' => '#{@index} {heading|"No heading"}',
'children' => [
'heading' => [
'type' => 'text',
'label' => 'Heading',
'textformatters' => ['TextformatterEntities'],
],
'body' => [
'type' => 'TinyMCE',
'label' => 'Text',
],
],
],
'gallery' => [
'label' => 'Gallery',
'children' => [
'images' => [
'type' => 'image',
'label' => 'Images',
'maxFiles' => 10,
'textformatters' => ['TextformatterEntities'],
],
'layout' => [
'type' => 'radios',
'label' => 'Layout',
'options' => [
'grid' => 'Grid',
'stacked' => 'Stacked',
],
],
],
],
],
],
];2. Render in your template
Read Flex values through the standard ProcessWire API (with output formatting enabled):
echo $page->content->intro;
foreach($page->content->blocks as $block) {
if($block->rowType() === 'text') {
echo "<h2>{$block->heading}</h2>";
echo $block->body;
} else if($block->rowType() === 'gallery') {
echo "<div>";
foreach($block->images as $image) {
$thumb = $image->size(800, 600);
echo "<img src='{$thumb->url}' alt='{$image->description}'>";
}
echo "</div>";
}
}3. Query with selectors
Search across structured properties using standard ProcessWire selectors:
// Find pages with a Text block whose heading matches "Architecture"
$matches = $pages->find('content.blocks.text.heading*=Architecture');
// Find pages containing more than one Gallery block
$withGalleries = $pages->find('content.blocks.gallery.count>1');Tip: Open the Flex field's settings in ProcessWire Admin to copy generated PHPDoc stubs for full IDE autocompletion.
Installation
Requirements: ProcessWire 3.0.259+, PHP 8.1+, MySQL 8.0+ or MariaDB 10.11+ (InnoDB).
- Download the ZIP for your version from GitHub Tags, unpack it, and copy its contents to
/site/modules/FieldtypeFlex/. - In ProcessWire Admin, go to Modules → Refresh and install FieldtypeFlex.
- Create a field of type Flex and add it to a template.
Bundled German, French, and Spanish admin translations can be installed from the module's Languages section.
Examples & documentation
- Configuration examples — ready-to-use PHP, JSON, and native Inputfield definitions covering Objects, nested Rows, Tables, conditional inputs, and custom media metadata.
- API reference — full reference for settings, value types, selectors, clipboard behavior, maintenance tools, and compatibility details.
- Pages Export/Import transfers Flex values through ProcessWire's native Pages module. Prepare the field, its definition, and the template on the destination first.
Known limitations
The following ProcessWire features are not supported:
- SQLite and PostgreSQL databases.
- Native ProcessWire page-version save/restore.
- Automatic backlink discovery (
$page->links()) and direct Fieldtype conversion to or from other Fieldtypes. - Compound or table-backed fields (
Repeater,RepeaterMatrix,PageTable,Password, or nestedFlex) as Flex properties — though Flex fields work inside native Repeaters. CKEditor(useTinyMCEinstead).- Page-reference selector traversal from typed Rows, across multiple hops, or into unsupported target fields.
- Native custom-field templates for files/images (use Flex
customFieldsinstead) and TinyMCE drag-and-drop uploads (which require a regular ProcessWire Image field as their target).
See API.md for full compatibility details.
Feedback & contributing
Bug reports, real-world feedback, and contributions are welcome. Feel free to open an issue or see CONTRIBUTING.md if you'd like to help.
License
Released under the MIT License.
More modules by interrobang
Textformatter Make HTML Links
This Textformatter will create HTML links out of anything that resembles a URL or email address, as long as it is not already part of an tag.19TextformatterMakeLinks by interrobang- Added 10 months ago by interrobang
FieldtypeFlex
Build structured content in one ProcessWire field: nested blocks, editable tables, and native Inputfields for rich text, images, files, and more1Added 6 hours ago by interrobang
Install and use modules at your own risk. Always have a site and database backup before installing new modules.