BreadcrumbFactory implements LoggerAwareInterface uses LoggerAwareTrait
Factory for creating breadcrumb contexts from controller actions.
This factory centralizes the logic for determining what context to show in breadcrumbs based on different controller actions (edit, new, list, etc.).
It handles:
- Record lookups and validation
- Creation of "new record" breadcrumb nodes
- Multi-record edit scenarios
- Parent record resolution
Subject to change until v15 LTS
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Interfaces
- LoggerAwareInterface
Methods
- __construct() : mixed
- forEditAction() : BreadcrumbContext
- Creates breadcrumb context for editing an existing record.
- forEditMultipleAction() : BreadcrumbContext
- Creates breadcrumb context for editing multiple records.
- forNewAction() : BreadcrumbContext
- Creates breadcrumb context for creating a new record.
- forPageArray() : BreadcrumbContext
- Creates breadcrumb context from a page record array.
- forResource() : BreadcrumbContext
- Creates breadcrumb context for any resource (file or folder).
Methods
__construct()
public
__construct(RecordFactory $recordFactory, IconFactory $iconFactory, TcaSchemaFactory $tcaSchemaFactory) : mixed
Parameters
- $recordFactory : RecordFactory
- $iconFactory : IconFactory
- $tcaSchemaFactory : TcaSchemaFactory
forEditAction()
Creates breadcrumb context for editing an existing record.
public
forEditAction(string $table, int $uid) : BreadcrumbContext
Parameters
- $table : string
-
The table name
- $uid : int
-
The record UID
Return values
BreadcrumbContext —Context containing the record or null on failure
forEditMultipleAction()
Creates breadcrumb context for editing multiple records.
public
forEditMultipleAction(string $table, int $pid) : BreadcrumbContext
Shows a generic "Edit Multiple [RecordType]" node instead of individual records.
Parameters
- $table : string
-
The table name
- $pid : int
-
The parent page ID
Return values
BreadcrumbContext —Context with parent page and "edit multiple" suffix node
forNewAction()
Creates breadcrumb context for creating a new record.
public
forNewAction(string $table, int $pid[, array<string|int, mixed> $defaults = [] ]) : BreadcrumbContext
Parameters
- $table : string
-
The table name
- $pid : int
-
The parent page ID
- $defaults : array<string|int, mixed> = []
-
Default values for the new record (used for icon overlay)
Return values
BreadcrumbContext —Context with parent page and "create new" suffix node
forPageArray()
Creates breadcrumb context from a page record array.
public
forPageArray(array<string|int, mixed> $pageRecord) : BreadcrumbContext
This is the most common migration path from DocHeaderComponent::setMetaInformation().
Example migration:
Before: $view->getDocHeaderComponent()->setMetaInformation($pageInfo);
After: $view->getDocHeaderComponent()->setBreadcrumbContext($this->breadcrumbFactory->forPageArray($pageInfo));
Parameters
- $pageRecord : array<string|int, mixed>
-
The page record array (must contain 'uid')
Return values
BreadcrumbContext —Context with the page record or null on failure
forResource()
Creates breadcrumb context for any resource (file or folder).
public
forResource(ResourceInterface $resource) : BreadcrumbContext
Parameters
- $resource : ResourceInterface
-
The resource (file or folder)
Return values
BreadcrumbContext —Context with the resource