Skip to main content
Version: Next

Extending the Customer Management Framework

CMF is a framework: most of its features (customer save handlers, segment builders, ActionTrigger rule elements, newsletter provider handlers, duplicate similarity matchers) are built around interfaces you implement and register as tagged Symfony services. Each feature chapter documents its own extension points, for example custom SegmentBuilders or custom customer save handlers.

This chapter covers extension points that cut across features: events dispatched by CMF, and how to add custom elements to the ActionTrigger rule editor in Pimcore Studio.

Custom Triggers, Conditions, and Actions

Additional bundles can add custom triggers, conditions, and actions to the ActionTrigger automation rule editor. This requires both a server-side and a Pimcore Studio frontend part.

Server-side (PHP):

  • A trigger implements CustomerManagementFrameworkBundle\ActionTrigger\Event\EventInterface (most triggers extend AbstractSingleCustomerEvent) and is dispatched on the Symfony event dispatcher.
  • A condition extends CustomerManagementFrameworkBundle\ActionTrigger\Condition\AbstractCondition (or AbstractMatchCondition).
  • An action extends CustomerManagementFrameworkBundle\ActionTrigger\Action\AbstractAction.

Use the CMF's own implementations as reference, for example the Add Segment action (AddSegment) or the Customer condition (Condition\Customer).

Pimcore Studio frontend (TypeScript/React):

The rule editor renders each trigger, condition, and action as a Dynamic Type from the Studio SDK's rule-builder module:

  • A trigger registers a class extending DynamicTypeRuleTriggerAbstract, with id set to the trigger's event name (for example plugin.cmf.cron-trigger, see Events).
  • A condition registers a class extending DynamicTypeRuleConditionAbstract, with id set to the condition PHP class's fully qualified name (for example \CustomerManagementFrameworkBundle\ActionTrigger\Condition\Customer).
  • An action registers a class extending DynamicTypeRuleActionAbstract, with id set to the action PHP class's fully qualified name (for example \CustomerManagementFrameworkBundle\ActionTrigger\Action\AddSegment).

Each of these classes provides a label (a translation key), a defaultValue, and a renderForm() method that returns the React form shown in the rule editor. See CMF's own implementations under assets/studio/js/src/modules/automation-rules/dynamic-types/ for reference.

GDPR Data Provider

CMF registers a GDPR data provider with the key customers in the Studio Backend Bundle's GDPR data extraction framework; no CMF-specific GDPR controllers are needed. The provider (CustomerDataProvider) exposes:

  • Customer search, filterable by id, firstname, lastname, and email.
  • Full customer data export.
  • Each customer's activity data.

Access to this provider requires the plugin_cmf_perm_customerview_admin permission (the same permission used for all other write operations on customers; see the Installation chapter's permission table). Downloading a single customer's data additionally requires the view element permission on that customer object.

Events

See Events for the full list of events CMF dispatches, grouped by area.