Skip to content

fedms_task

The task module owns the operational layer of FedMS: the fedms_task content entity, the fedms_task_pattern config entity, the action plugins that spawn tasks, the ECA condition plugins that make patterns declarative, and the Views that list tasks.

GitLab

fedms/components/tasks

What it ships

Content entity

Entity type Purpose
fedms_task A task instance. Revisionable, owner-aware.

Fields (see Concepts → Tasks and milestones for the user-facing description):

Field Type
label string
status boolean (completion flag)
uid entity_reference (user)
assignee entity_reference (user) — required
group entity_reference (group) — required
milestone entity_reference (taxonomy_term) — required
pattern entity_reference (fedms_task_pattern)
actionable, due timestamp
attachment, media, node, user, webform, webform_submission polymorphic targets
created, changed created / changed

Config entity

Entity type Purpose
fedms_task_pattern Template that the spawning engine reads.

Properties:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
id:
label:
taskLabel:                # token-replaceable label for the spawned task
milestone:                # UUID of fedms_task_milestone term
rule:                     # ECA rule ID to attach to
conditions: []            # condition plugin IDs
conditionArguments: {}    # arguments per condition
successors: []            # follow-up pattern IDs
actionableRelation:       # 'task created' | 'session start' | 'session end'
actionableRelationDate:   # DateTime::modify() string
dueRelation:              # same
dueRelationDate:          # same

See src/Entity/TaskPattern.php.

Taxonomy

taxonomy.vocabulary.fedms_task_milestone — milestones.

Views

  • views.view.entity_tasks — tasks per entity.
  • views.view.milestones — milestone overview.
  • views.view.milestone_tasks — tasks grouped by milestone.

Base field hook (fedms_task.module)

hook_entity_base_field_info adds a fedms_task_patterns base field to:

  • media
  • node

(fedms_attachment ships its own equivalent base field directly on the entity.)

The field is a multi-value list of pattern IDs, populated from fedms_task_select_task_patterns() which returns all enabled patterns.

Action plugins (src/Plugin/Action/)

Plugin Purpose
CreateTaskFromPattern Base class. Loads patterns for the current ECA rule, evaluates conditions, creates tasks for each referencing entity.
CreateTaskFromPatternGroupContent Spawn variant for group content.
CreateTaskFromPatternManual Manual one-shot spawning.
CreateTaskFromPatternWebform Webform-specific spawning (creates the empty draft submission to disambiguate).
CreateTaskFromPatternAbout "About this entity" spawning.
CreateTaskFromPatternSuccessors Successor chain expansion.
TokenSetTaskPatternList Sets a token holding the list of applicable patterns.

ECA event plugins (src/Plugin/ECA/Event/)

Plugin What it asks
TaskPatternConditionEvent Dispatches the condition evaluation as a Symfony event so the model can decide.
TaskPatternConditionArgumentsEvent Dispatches the arguments providing event.

These are the bridge between the task_api ECA model and the condition logic. The model uses condition IDs like fedms_task_pattern_is_event, fedms_task_pattern_check_event_type, etc. — see task_api for the full list.

Module dependencies

1
2
3
4
- drupal:node
- fedms_attachment:fedms_attachment
- smart_date:smart_date
- webform:webform

Where the logic lives

Concern File
Task entity src/Entity/Task.php
Pattern entity src/Entity/TaskPattern.php
Pattern interface src/TaskPatternInterface.php
Spawning action plugins src/Plugin/Action/*.php
ECA condition events src/Plugin/ECA/Event/*.php
Helper service src/Helper.php
Pattern form src/Form/TaskPatternForm.php
Pattern list builder src/TaskPatternListBuilder.php

When to change this module

  • Adding a polymorphic target type to fedms_task.
  • Adding a new ECA condition plugin (and updating the model that uses it).
  • Changing the deduplication / open-task lookup logic.
  • Adding new views for task reporting.

When not to change this module

  • Authoring actual patterns for a specific tenant — those go in the tenant's exported config.
  • Changing the lifecycle behavior (start / end flag flipping) — that's in fedms_federation and fedms_eca.

Strict types

fedms_task uses declare(strict_types=1); throughout. Maintain this in new files.

Next steps