Conditions & Relation Pickers
React provides a visual condition rule builder (InputfieldReactCondition) and four dedicated relation pickers (InputfieldReactM2O, InputfieldReactM2M, InputfieldReactO2M, InputfieldReactM2A) backed by the signed /_react/relation gateway.
Condition Builder (InputfieldReactCondition & ConditionEvaluator)
Section titled “Condition Builder (InputfieldReactCondition & ConditionEvaluator)”InputfieldReactCondition (dist/InputfieldReactCondition.js) lets administrators author structured conditional logic without writing raw PHP or selector strings:
- Visual Rule Groups: Build nested
AND/ORgroups with typed field schemas, comparison operators (equals,not_equals,contains,starts_with,gt,gte,lt,lte,in,not_in,is_empty,is_not_empty), and value inputs. - Expression Mode: Toggle to inspect or edit compact expression strings when needed.
- Server-Side Evaluation (
ConditionEvaluator): Evaluate stored condition JSON payloads against any associative context array in PHP:
<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\React\Condition\ConditionEvaluator;
$evaluator = new ConditionEvaluator();$matches = $evaluator->evaluate($rulePayload, [ 'country' => 'TR', 'orderTotal' => 450, 'isMember' => true,]);Relation Pickers (M2O, M2M, O2M, M2A)
Section titled “Relation Pickers (M2O, M2M, O2M, M2A)”All four relation Inputfields share the isolated dist/InputfieldReactRelation.js bundle and query /_react/relation using HMAC-SHA256 signed relation tokens:
| Module | Relationship | Supported Display Modes |
|---|---|---|
InputfieldReactM2O |
Many-to-One (single target) | Select dropdown, live Autocomplete card, Radio cards, hierarchical TreeSelect |
InputfieldReactM2M |
Many-to-Many (ordered multiple targets) | Sortable MultiSelect list, 2-column Checkboxes, Picker Drawer, Dual-List Transfer widget |
InputfieldReactO2M |
One-to-Many (child collection) | Embedded subtable and cards view with quick add/edit actions |
InputfieldReactM2A |
Many-to-Any (polymorphic targets) | Multi-resource selector linking records across heterogeneous types |
8 Built-In Relation Resources
Section titled “8 Built-In Relation Resources”Out of the box, RelationResourceRegistry exposes eight ProcessWire-native resources:
pages: ProcessWire pages (respecting$page->viewable()/$page->editable()RBAC and optional template/parent filters)templates: ProcessWire templatesfields: ProcessWire fieldsusers: ProcessWire user accountsroles: ProcessWire rolespermissions: ProcessWire permissionslanguages: ActiveLanguageSupportlanguagesmodules: Installed ProcessWire modules
Cascading Filters (dependsOn) & Custom Resources
Section titled “Cascading Filters (dependsOn) & Custom Resources”- Cascading filters (
dependsOn): Bind one relation field to another field’s current value so selecting a parent country, category, or template dynamically narrows the options returned by/_react/relation. - Custom resources (
RelationResourceInterface): Downstream modules register their own relation resources (such as Entries collections or Commerce products) lazily viaReact::registerRelationResources('reactCapabilities' => ['relations']).