Skip to content

Connecting Entries to Pages

FieldtypeEntries connects ProcessWire pages to Entries blueprints and Managed Tables. Under Setup -> Fields -> Add New Field, Entries provides three one-click field presets (FieldtypeEntries::getFieldSetups()): Entry: Reference, Entry: Embedded, and Entry: Managed Table.

Each ProcessWire page owns its own dedicated root EntryItem (page_id = $page->id). Use this for page-specific specs, hero settings, or repeatable blocks owned by that page.

  • Set bindingMode to embedded.
  • Leave blueprintType blank to auto-match a blueprint matching $field->name, or point to a specific blueprint or @fieldset:<name>.
  • Enable hideWrap = 1 to blend the blueprint fields into the page editor without an extra outer fieldset border.

Filtering selectable entries (findItemsSelector)

Section titled “Filtering selectable entries (findItemsSelector)”

In Reference Mode, constrain which records editors can pick using:

  • blueprintTypes: Allow records from multiple collections (['ports', 'anchorages']).
  • parent_id: For hierarchical: true collections, restrict options to children of a specific root UUID.
  • findItemsSelector with dynamic =page.field interpolation: Filter choices using values on the currently edited ProcessWire page:
    • country=page.country resolves $page->country (supporting EntryItem::id, Page::id, or scalar values).
    • season_code=page.charter_season.code traverses nested properties on the current page.

Editor widgets (InputfieldEntries and native selectors)

Section titled “Editor widgets (InputfieldEntries and native selectors)”

On the field’s Input tab, choose between the interactive React workspace or native ProcessWire selection inputs:

  • Interactive React Workspace (InputfieldEntries): Supports five display styles (picker, table, cards, kanban, calendar), tableColumns, cardColumns (1..4), previewImageField, hideSelected, inline creation (addable), modal quick-edit (allowQuickEdit), inline publish toggle (allowStatusToggle), and one-click clone (allowQuickClone).
  • Native ProcessWire delegates:
    • Single-value: InputfieldSelect, InputfieldRadios, _InputfieldTextTags
    • Multi-value: InputfieldAsmSelect, InputfieldCheckboxes, InputfieldSelectMultiple, InputfieldTextTags
  • Custom labels: Set labelFieldName (or labelFieldName = '.' with labelFieldFormat = '{title} ({port_code}) - {country.title}').
  1. Open Setup -> Fields -> Add New Field, pick one of the Entry: presets (or choose Entries (FieldtypeEntries)), name your field, and click Save.

  2. On the Details tab, select the Binding Mode, target blueprint(s), derefAs, minItems/maxItems, and optional pivotBlueprint.

  3. On the Input tab, choose the widget style, label format, and findItemsSelector.

  4. Save the field and add it to your template under Setup -> Templates.

<?php
declare(strict_types=1);
namespace ProcessWire;
$fields = $this->wire()->fields;
/** @var EntriesField $field */
$field = $fields->get('departure_port') ?? $this->wire(new EntriesField());
$field->name = 'departure_port';
$field->label = 'Departure Port';
$field->type = $this->wire()->modules->get('FieldtypeEntries');
$field->setBlueprint('ports');
// Multi-blueprint or hierarchical scoping:
// $field->setBlueprints(['ports', 'anchorages'])->setParent($rootUuid);
$field->derefAs = FieldtypeEntries::DEREF_SINGLE_OR_EMPTY;
$field->inputfieldWidget = 'cards';
$field->cardColumns = 3;
$field->labelFieldFormat = '{title} ({port_code})';
$field->addable = true;
$field->allowQuickEdit = true;
$field->allowStatusToggle = true;
$field->allowQuickClone = true;
$fields->save($field);

Querying ProcessWire pages by entry subfields

Section titled “Querying ProcessWire pages by entry subfields”

FieldtypeEntries integrates directly with $pages->find(), including system subfields (.id, .name, .status, .count) and same-row @ pivot correlation:

site/templates/yachts.php
<?php
declare(strict_types=1);
namespace ProcessWire;
// Embedded or referenced entry subfields
$yachts = $pages->find('template=yacht, charter_rates.season=high, charter_rates.price<=20000, limit=24');
// Negative, empty, and count queries
$nonLow = $pages->find('template=yacht, charter_rates.season!=low, limit=24');
$unassigned = $pages->find('template=yacht, charter_rates.season="", limit=24');
$multiRate = $pages->find('template=yacht, charter_rates.count>=2, limit=24');
// Same-row correlation on pivot references
$doubleJacuzzi = $pages->find('template=yacht, @amenities.target.name=jacuzzi, @amenities.quantity>=2, limit=24');

Find every page referencing a specific collection entry with $item->referencingPages('template=yacht').

Customize selectable options or rendered labels dynamically in site/ready.php:

  • InputfieldEntries::getSelectableItems(?Page $page = null, string $filterSelector = ''): EntryArray
  • InputfieldEntries::renderItemLabel(EntryItem $item): string

Next steps