Skip to content

Fieldsets, Relations & Integrations

Contacts extends far beyond Setup -> Contacts: it provides reusable embedded fieldsets for ProcessWire Users and Pages, searchable React relation pickers for any Entries blueprint, and four lazy sibling module integrations.

Composable User & Page Fieldsets (@fieldset:contacts-*)

Section titled “Composable User & Page Fieldsets (@fieldset:contacts-*)”

Three public fieldsets can be embedded directly on any ProcessWire template via FieldtypeEntries or scaffolded with contacts:scaffold:user:

  • contacts-profile (preset contacts_profile): Personal contact profile, channels, and addresses.
  • contacts-organization (preset contacts_organization): Organization billing and legal profile.
  • contacts-memberships (preset contacts_memberships): Primary organization and pivot memberships.
Terminal window
# Preview attaching profile & memberships to the ProcessWire user template
php vendor/bin/wire contacts:scaffold:user --template=user --sections=profile,memberships --prefix=contact_ --style=card --allow-user-template --dry-run --json

Resolve a user’s profile uniformly regardless of whether data lives in an embedded fieldset or a linked directory record:

<?php
declare(strict_types=1);
namespace ProcessWire;
$contacts = Contacts::requireInstance($this);
$subject = $contacts->resolveUserSubject($this->wire()->user);
$email = (string) $subject->get('primary_email', 'contacts-profile');

React Relation Pickers (contact & organization)

Section titled “React Relation Pickers (contact & organization)”

Any Entries blueprint can link directly to directory records via m2o or m2m fields with built-in search, filtering (role, tag, organization, exclude), hierarchical organization tree browsing, and permission-checked quickCreate:

<?php
declare(strict_types=1);
namespace ProcessWire;
$fields = [
'broker_ref' => [
'type' => 'm2o',
'resource' => 'contact',
'label' => 'Primary Broker',
],
'agency_ref' => [
'type' => 'm2o',
'resource' => 'organization',
'label' => 'Brokerage Agency',
],
];

Optional Sibling Integrations (src/Integration/*)

Section titled “Optional Sibling Integrations (src/Integration/*)”

Hydrates default_currency options in contacts-organizations, contacts-settings, and contacts-organization directly from live currency-currencies entries (falling back to ISO 4217 when Currency is not installed).

  • Portal Inviter: Registers registerPortalInviter() so ContactActionBar can invite contacts to the customer portal (contacts-manage + account-admin or superuser).
  • Notification Target Enrichment: Lazily enriches Account notification targets with contact email, E.164 phone, locale, and display title via Account::beforeNotificationSend.
  • Safe Profile Sync: Syncs account.user.registered, account.profile.updated, and account-profiles / @fieldset:account-profile saves strictly by linked_user_id and verified primary_email (never by phone number).
  • Account Deletion: Handles account.deleted per account_anonymize_on_delete.

When forms_auto_capture = 1, listens to Forms::afterSubmit on valid non-spam submissions (unless $form->integrationsConfig['contacts'] is customized or _skip_contact_capture is set), upserts a contact with the lead role, records ConsentPurpose::MarketingEmail on newly created leads only when marketing_opt_in is truthy (never overwriting an existing opted-out contact), and logs a timeline interaction note.

Exposes 7 REST endpoints with scopes contacts:read, contacts:write, and contacts:admin plus outbound webhooks (contacts.contact.saved|merged|anonymized, contacts.organization.saved|merged):

Endpoint Methods Scope & RBAC Notes
/api/v1/contacts GET, POST contacts:read / contacts:write List/search (GET), deduplicated upsert (POST).
/api/v1/contacts/{id} GET, PATCH, PUT contacts:read / contacts:write Read or update single contact (409 if anonymized, 400 on empty PATCH).
/api/v1/contacts/{id}/privacy-export GET contacts:admin (+ contacts-admin) Full GDPR subject data export bundle.
/api/v1/contacts/{id}/anonymize POST contacts:admin (+ contacts-admin) UUID-preserving GDPR erasure.
/api/v1/contacts/organizations GET, POST contacts:read / contacts:write List/search or upsert organization.
/api/v1/contacts/organizations/{id} GET, PATCH, PUT contacts:read / contacts:write Read or update organization.
/api/v1/contacts/notes GET, POST contacts:read / contacts:write Supports related_ref, follow_up_at, assigned_user_id, is_completed.

Participant Pull-Discovery (contactsParticipant)

Section titled “Participant Pull-Discovery (contactsParticipant)”

Downstream modules integrate lazily with merges, timelines, and GDPR exports by declaring 'autoload' => false, 'contactsParticipant' => true in getModuleInfo() and attaching hooks inside init(). See site/modules/Contacts/examples/real-world/participant-hooks.php for a complete working example.

Next steps