Skip to content

For Developers

The module adds plugins to two plugin systems and no services of its own.

Plugin Type Class
flowdrop_workflow_action Field Widget Action FlowDropWorkflowAction
entity_reference_workflow_action Field Widget Action EntityReferenceWorkflowAction (extends the above)
field_content_processor FlowDrop node processor FieldContentProcessor
field_suggestion_output FlowDrop node processor FieldSuggestionOutput

Each node processor is exposed in the editor through a flowdrop_node_type config entity in config/install, with the ID flowdrop_field_widget_actions_<processor id>. The node type sets which parameters are configurable or connectable and which outputs are exposed.

classDiagram
    FieldWidgetActionBase <|-- FlowDropWorkflowAction
    FlowDropWorkflowAction <|-- EntityReferenceWorkflowAction
    AbstractFlowDropNodeProcessor <|-- FieldContentProcessor
    AbstractFlowDropNodeProcessor <|-- FieldSuggestionOutput
    FlowDropWorkflowAction ..> SynchronousPipelineOrchestrator : orchestrate()
    FlowDropWorkflowAction ..> FieldContentProcessor : initial data
    FlowDropWorkflowAction ..> FieldSuggestionOutput : reads processed_content

There is no .api.php file and the module dispatches no events. Extension points:

  • Write workflows. The contract between the action and a workflow is the initial context and the output key. See Workflow execution.
  • Write node processors that return the output key or no_match. See Node processors.
  • Subclass the actions. Both action classes are not final. The protected methods executeWorkflowWithFormState(), returnSuggestions() and getTargetElement() are the ones EntityReferenceWorkflowAction overrides, and the natural places to change behavior for other field types.

Front-end libraries

Library Used by Purpose
field_widget both actions Styling for the suggestion UI.
inline_messages both actions $.fn.flowdropShowInlineMessage(selector, message, type), called through InvokeCommand to show a dismissible message next to a field.
selectable_chips entity reference action Drupal.behaviors.flowdropSelectableChips and the Drupal.flowdropSelectableChips helpers that add chips to autocomplete, Tagify and tree widgets.

Configuration schema

Action settings are stored in the widget's Field Widget Actions settings and described by field_widget_action.plugin.flowdrop_workflow_action and field_widget_action.plugin.entity_reference_workflow_action in config/schema/flowdrop_field_widget_actions.schema.yml.

Tests

Unit tests for all four plugins live in tests/src/Unit. The drupal.org GitLab CI template runs them with PHPCS, PHPStan and cspell.