WorkflowTriggerRegistry
in package
Workflow Trigger Registry
Static registry for workflow trigger events. Plugins register events that can start workflows (e.g., 'Officers.HireRequested'). Follows the ViewCellRegistry pattern for consistency.
Table of Contents
Constants
- REQUIRED_FIELDS : mixed = ['event', 'label', 'description', 'payloadSchema']
- Required fields for each trigger registration.
Properties
- $initialized : bool
- $triggers : array<string|int, mixed>
Methods
- clear() : void
- Clear all registered triggers.
- getAllTriggers() : array<string|int, mixed>
- Get all registered triggers.
- getDebugInfo() : array<string|int, mixed>
- Get debug information about registered triggers.
- getForDesigner() : array<string|int, mixed>
- Get a simplified view for the visual designer UI.
- getRegisteredSources() : array<string|int, mixed>
- Get all registered source identifiers.
- getTrigger() : array<string|int, mixed>|null
- Get a single trigger by event name.
- getTriggersBySource() : array<string|int, mixed>
- Get triggers for a specific source.
- isRegistered() : bool
- Check if a source is registered.
- register() : void
- Register triggers from a source plugin.
- unregister() : void
- Remove triggers from a specific source.
- ensureInitialized() : void
- Ensure the registry is initialized.
- validateRequiredFields() : void
- Validate that required fields are present in a registration entry.
Constants
REQUIRED_FIELDS
Required fields for each trigger registration.
private
mixed
REQUIRED_FIELDS
= ['event', 'label', 'description', 'payloadSchema']
Properties
$initialized
private
static bool
$initialized
= false
$triggers
private
static array<string|int, mixed>
$triggers
= []
Methods
clear()
Clear all registered triggers.
public
static clear() : void
getAllTriggers()
Get all registered triggers.
public
static getAllTriggers() : array<string|int, mixed>
Return values
array<string|int, mixed> —All triggers keyed by source
getDebugInfo()
Get debug information about registered triggers.
public
static getDebugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —Debug information
getForDesigner()
Get a simplified view for the visual designer UI.
public
static getForDesigner() : array<string|int, mixed>
Return values
array<string|int, mixed> —Designer-safe trigger data (no class names)
getRegisteredSources()
Get all registered source identifiers.
public
static getRegisteredSources() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of registered source identifiers
getTrigger()
Get a single trigger by event name.
public
static getTrigger(string $eventName) : array<string|int, mixed>|null
Parameters
- $eventName : string
-
Event identifier (e.g., 'Officers.HireRequested')
Return values
array<string|int, mixed>|null —Trigger configuration or null if not found
getTriggersBySource()
Get triggers for a specific source.
public
static getTriggersBySource(string $source) : array<string|int, mixed>
Parameters
- $source : string
-
Source identifier
Return values
array<string|int, mixed> —Triggers from the specified source
isRegistered()
Check if a source is registered.
public
static isRegistered(string $source) : bool
Parameters
- $source : string
-
Source identifier
Return values
bool —True if registered
register()
Register triggers from a source plugin.
public
static register(string $source, array<string|int, mixed> $triggers) : void
Parameters
- $source : string
-
Source identifier (e.g., 'Officers', 'Awards')
- $triggers : array<string|int, mixed>
-
Array of trigger configurations
Tags
unregister()
Remove triggers from a specific source.
public
static unregister(string $source) : void
Parameters
- $source : string
-
Source identifier to remove
ensureInitialized()
Ensure the registry is initialized.
private
static ensureInitialized() : void
validateRequiredFields()
Validate that required fields are present in a registration entry.
private
static validateRequiredFields(array<string|int, mixed> $entry, array<string|int, mixed> $requiredFields, string $source) : void
Parameters
- $entry : array<string|int, mixed>
-
Registration entry to validate
- $requiredFields : array<string|int, mixed>
-
Required field names
- $source : string
-
Source identifier for error messages