WorkflowAdmin
Reference for the WorkflowAdmin module: an admin interface for human-processing workflows. Other modules register a workflow up front, supplying callbacks that produce the pending item ids, their count, their display names and the panel that processes one item; the admin section then lists every workflow, pages through its items, and drills into a single item for processing.
This page is a pure reference. For how the framework fits together, see the Guide.
WorkflowAdminConfig- register human-processing workflows and read the registered set.WorkflowAdminConfigWorkflow- a single registered workflow and its callbacks.WorkflowAdminConfigWorkflowItem- a workflow item id paired with its database row.WorkflowAdminEntryData- the id of a single pending workflow item.WorkflowAdminDatabase- read a workflow's size and pending entries through its callbacks.WorkflowAdminUi- register the Workflow admin section.WorkflowAdminViewUi- the View section, drilling into one workflow and its items.WorkflowAdminPageUi- the list and item pages of the admin section.WorkflowAdminPanelUi- panels that render a workflow and process an item.
WorkflowAdminConfig
Register the human-processing workflows a module needs, and read the registered set. Each workflow is keyed by module name and workflow name, and by a unique identifier. Registration is the cross-module configuration API for this module.
AddWorkflow
WorkflowAdminConfig::AddWorkflow(string $moduleName, string $workflowName, string $displayName, string $identifier, string $tableName, callable $entriesCallback, callable $countCallback, callable $sectionCallback, callable $displayNameCallback, string $listPagePath): void
Register a workflow for human processing. Throws when the identifier is already registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | Module name, used for error logging. |
$workflowName | string | Workflow name identifier. |
$displayName | string | Human-readable display name for the workflow. |
$identifier | string | Unique identifier; a UrlName starting with the module name and ending with Workflow. |
$tableName | string | Table name for reference, displayed in the admin UI. |
$entriesCallback | callable | Returns workflow item ids; receives a start and a limit, returns a list of ids. |
$countCallback | callable | Returns the total count of workflow items. |
$sectionCallback | callable | Renders the section for a workflow item; receives the row id. |
$displayNameCallback | callable | Returns display names for ids; receives a list of ids, returns a map of id to display name. |
$listPagePath | string | Admin path to the list page with filters applied. |
Returns void
GetModuleNames
WorkflowAdminConfig::GetModuleNames(): array
The unique module names from the registered workflows, sorted alphabetically.
Returns array A list of module name strings.
GetWorkflow
WorkflowAdminConfig::GetWorkflow(string $moduleName, string $workflowName): ?WorkflowAdminConfigWorkflow
The registered workflow for a module name and workflow name, or null when none is registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module the workflow belongs to. |
$workflowName | string | The workflow name. |
Returns ?WorkflowAdminConfigWorkflow The workflow, or null.
GetWorkflowByIdentifier
WorkflowAdminConfig::GetWorkflowByIdentifier(string $identifier): ?WorkflowAdminConfigWorkflow
The registered workflow for a unique identifier, or null when none is registered.
| Name | Type | Description |
|---|---|---|
$identifier | string | The workflow identifier. |
Returns ?WorkflowAdminConfigWorkflow The workflow, or null.
GetWorkflowNames
WorkflowAdminConfig::GetWorkflowNames(): array
The unique workflow names from the registered workflows, sorted.
Returns array A list of workflow name strings.
GetWorkflows
WorkflowAdminConfig::GetWorkflows(): array
Every registered workflow.
Returns array A list of WorkflowAdminConfigWorkflow.
GetWorkflowsByModule
WorkflowAdminConfig::GetWorkflowsByModule(): array
The registered workflows grouped by module name, sorted by module name.
Returns array A map of module name to a list of WorkflowAdminConfigWorkflow.
GetWorkflowsForModule
WorkflowAdminConfig::GetWorkflowsForModule(string $moduleName): array
The registered workflows for a single module.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module to read workflows for. |
Returns array A list of WorkflowAdminConfigWorkflow.
WorkflowAdminConfigWorkflow
A single registered workflow: its names and identifier, the reference table name, the four callbacks that drive it, and the list page path. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$workflow->moduleName | string | Module name, used for error logging (readonly). |
$workflow->workflowName | string | Workflow name identifier (readonly). |
$workflow->displayName | string | Human-readable display name (readonly). |
$workflow->identifier | string | Unique identifier (readonly). |
$workflow->tableName | string | Reference table name (readonly). |
$workflow->entriesCallback | mixed | Callback returning workflow item ids (readonly). |
$workflow->countCallback | mixed | Callback returning the total count of items (readonly). |
$workflow->sectionCallback | mixed | Callback rendering the section for an item (readonly). |
$workflow->displayNameCallback | mixed | Callback returning display names for ids (readonly). |
$workflow->listPagePath | string | Admin path to the list page (readonly). |
__construct
new WorkflowAdminConfigWorkflow(string $moduleName, string $workflowName, string $displayName, string $identifier, string $tableName, mixed $entriesCallback, mixed $countCallback, mixed $sectionCallback, mixed $displayNameCallback, string $listPagePath)
Create a registered workflow from its names, identifier, table name, callbacks and list page path.
| Name | Type | Description |
|---|---|---|
$moduleName | string | Module name, used for error logging. |
$workflowName | string | Workflow name identifier. |
$displayName | string | Human-readable display name. |
$identifier | string | Unique identifier. |
$tableName | string | Reference table name. |
$entriesCallback | mixed | Callback returning workflow item ids. |
$countCallback | mixed | Callback returning the total count of items. |
$sectionCallback | mixed | Callback rendering the section for an item. |
$displayNameCallback | mixed | Callback returning display names for ids. |
$listPagePath | string | Admin path to the list page. |
Returns WorkflowAdminConfigWorkflow
WorkflowAdminConfigWorkflowItem
A workflow item: its id paired with the database row it came from. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$item->id | int | The workflow item id (readonly). |
$item->row | object | The database row for the item (readonly). |
__construct
new WorkflowAdminConfigWorkflowItem(int $id, object $row)
Create a workflow item from an id and its database row.
| Name | Type | Description |
|---|---|---|
$id | int | The workflow item id. |
$row | object | The database row for the item. |
Returns WorkflowAdminConfigWorkflowItem
WorkflowAdminEntryData
A workflow entry: the id of a single pending workflow item, without the full row. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$entry->id | int | The workflow item id (readonly). |
__construct
new WorkflowAdminEntryData(int $id)
Create a workflow entry from an item id.
| Name | Type | Description |
|---|---|---|
$id | int | The workflow item id. |
Returns WorkflowAdminEntryData
WorkflowAdminDatabase
Read a workflow's size and its pending entries, by invoking the callbacks the workflow was registered with.
GetNextItemOptional
WorkflowAdminDatabase::GetNextItemOptional(WorkflowAdminConfigWorkflow $workflow): ?WorkflowAdminEntryData
The first pending entry of a workflow, or null when there are none.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to read from. |
Returns ?WorkflowAdminEntryData The first entry, or null.
GetWorkflowEntries
WorkflowAdminDatabase::GetWorkflowEntries(WorkflowAdminConfigWorkflow $workflow, int $start = 0, int $limit = 10): array
A page of pending entries for a workflow, from an offset up to a limit.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to read from. |
$start | int | The offset to start from. |
$limit | int | The maximum number of entries to return, 1 to 1000. |
Returns array A list of WorkflowAdminEntryData.
GetWorkflowSize
WorkflowAdminDatabase::GetWorkflowSize(WorkflowAdminConfigWorkflow $workflow): int
The current number of pending items in a workflow.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to measure. |
Returns int The number of pending items.
WorkflowAdminUi
Registers the Workflow admin section, with its List and View sub-sections. Called by the module when it registers with the admin system.
Section
WorkflowAdminUi::Section(): void
Register the Workflow admin section, routing its List and View sub-sections.
Returns void
WorkflowAdminViewUi
The View section: lists every workflow identifier as navigation, then drills into a single workflow to page its items and view one at a time.
Section
WorkflowAdminViewUi::Section(): void
Render the View section: navigation over every registered workflow identifier, routing each into its own sub-section, and a redirect to the first.
Returns void
WorkflowSection
WorkflowAdminViewUi::WorkflowSection(WorkflowAdminConfigWorkflow $workflow, string $identifierUrlName): void
Render one workflow's section: a List tab paging its items, and a View tab drilling into a single item by id.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to render. |
$identifierUrlName | string | The workflow identifier lowercased, used in the path. |
Returns void
WorkflowAdminPageUi
The pages of the admin section: the overview list of every workflow, a paged list of one workflow's items, and the view of a single item.
List
WorkflowAdminPageUi::List(): void
Render the overview: a table of every registered workflow with its module, identifier, display name, table, pending count and a view action.
Returns void
WorkflowItem
WorkflowAdminPageUi::WorkflowItem(WorkflowAdminConfigWorkflow $workflow, int $itemId, string $basePath): void
Render a single workflow item's page, calling the workflow's section callback to process it; shows an error when the item is no longer in the queue.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow the item belongs to. |
$itemId | int | The id of the item to view. |
$basePath | string | The admin base path for the workflow. |
Returns void
WorkflowItemList
WorkflowAdminPageUi::WorkflowItemList(WorkflowAdminConfigWorkflow $workflow, int $page = 1): void
Render a paged list of a workflow's pending items, with their ids, display names, a view action and the total pending count.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to list. |
$page | int | The page number, starting at 1. |
Returns void
WorkflowAdminPanelUi
Panels for the admin section: the overview panel, a per-workflow panel with its pending entries and details, and the panel that runs a workflow's processing callback for one item.
ListPanel
WorkflowAdminPanelUi::ListPanel(): void
Render a table of every registered workflow, with its module, identifier, display name, table, pending count and a view action.
Returns void
Panel
WorkflowAdminPanelUi::Panel(string $moduleName, string $workflowName): void
Render a panel for one workflow, found by module name and workflow name, showing up to ten pending entries and a view-all action; shows a not-found message when it is not registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module the workflow belongs to. |
$workflowName | string | The workflow name. |
Returns void
ProcessPanel
WorkflowAdminPanelUi::ProcessPanel(WorkflowAdminConfigWorkflow $workflow, int $rowId): void
Render the processing panel for one item by invoking the workflow's section callback, logging and showing an error status when the callback throws.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow the item belongs to. |
$rowId | int | The id of the item to process. |
Returns void
Workflow
WorkflowAdminPanelUi::Workflow(WorkflowAdminConfigWorkflow $workflow): void
Render a panel for one workflow, showing up to ten pending entries, a view-all action and a collapsible details section.
| Name | Type | Description |
|---|---|---|
$workflow | WorkflowAdminConfigWorkflow | The workflow to render. |
Returns void