Plugin configuration reference
Each Membership Type stores plugin settings in membership_term_config. Keys depend on the selected term plugin. Values are edited on the Membership Type form via each plugin’s configuration form methods.
Schema prefix: crm_membership.crm_membership_type.* — membership_term_config uses type: ignore in config schema so plugin-specific shapes are not validated centrally.
Shared concepts
| Key | Used by | Description |
|---|---|---|
grace_period |
Fixed, Rolling | Integer days after period end date during which isActiveFor() still returns true. Default 0. |
time_gap_duration |
Fixed, Rolling | ISO 8601 duration string (via duration_field). Minimum gap between consecutive periods on renew. Default PT1S. |
duration |
Fixed, Rolling | ISO 8601 duration string. Length of each membership period. Required. |
Duration and interval fields use the Duration Field module’s form widgets.
fixed_duration
Plugin ID: fixed_duration
Class: Drupal\crm_membership\Plugin\MembershipTerm\FixedDuration
| Key | Type | Default | Description |
|---|---|---|---|
duration |
duration string | — | Period length (e.g. P1Y for one year). Required. |
start_time |
datetime (storage format) | current time | Anchor for calculating fixed period boundaries (e.g. January 1 each year). |
grace_period |
integer (days) | 0 |
Days after end date to still consider member active. |
time_gap_duration |
duration string | PT1S |
Gap enforced between periods on renewal. |
rollover |
duration string | null | If set, activations on/after (period start + rollover) extend to the next period end. Must be shorter than duration (validated on form). |
Rollover example: Yearly membership starting January 1 with 8-month rollover — join before September 1 → expires December 31 same year; join on/after September 1 → expires December 31 following year.
Attribute flags: allowOverrideStartDate: true, allowOverrideEndDate: true.
rolling_duration
Plugin ID: rolling_duration
Class: Drupal\crm_membership\Plugin\MembershipTerm\RollingDuration
| Key | Type | Default | Description |
|---|---|---|---|
duration |
duration string | — | Period length from activation/renewal start. Required. |
grace_period |
integer (days) | 0 |
Grace period after end date. |
time_gap_duration |
duration string | PT1S |
Gap between periods on renewal. |
Period start/end are calculated from activation time (or overrides). No fixed calendar anchor or rollover.
Attribute flags: allowOverrideStartDate: true, allowOverrideEndDate: true.
lifetime
Plugin ID: lifetime
Class: Drupal\crm_membership\Plugin\MembershipTerm\Lifetime
No configuration keys. Creates a period with a start date and no end date. Renewal is a no-op (allowRenewal() returns false).
Attribute flags: allowOverrideStartDate: true, allowOverrideEndDate: false.
Form integration
On MembershipTypeForm:
- User selects plugin → AJAX reloads
#term-config-wrapper. - Plugin
buildConfigurationForm($current_config, $form_state)renders fields. - On submit:
validateConfigurationForm()thensaveConfiguration()→ stored on the type entity.
Custom plugins should follow the same three-method pattern. See Custom plugins.
Related
- Interface — Configuration form methods
- Forms and workflows — Type form AJAX behavior
- Status and periods — Grace period effect