BreadcrumbContext
Read onlyYes
FinalYes
Represents a breadcrumb context with the main entity and optional suffix nodes.
A breadcrumb context consists of:
- A main context (record or resource) that determines the base breadcrumb trail
- Optional suffix nodes that are appended after the main trail
Suffix nodes are useful for:
- "New Record" indicators when creating records
- "Edit Multiple" indicators when editing multiple records
- Custom action indicators
Example usage:
// Edit existing record
$context = new BreadcrumbContext($record, []);
// Create new record (shows: Pages > Parent Page > "Create New Content")
$suffixNode = new BreadcrumbNode(identifier: 'new', label: 'Create New Content');
$context = new BreadcrumbContext($parentPage, [$suffixNode]);
Subject to change until v15 LTS
Table of Contents
Properties
- $mainContext : RecordInterface|ResourceInterface|null
- $suffixNodes : array<string|int, mixed>
Methods
- __construct() : mixed
- hasContext() : bool
- Checks if this context has a valid main entity.
- hasSuffixNodes() : bool
- Checks if this context has suffix nodes.
Properties
$mainContext
public
RecordInterface|ResourceInterface|null
$mainContext
$suffixNodes
public
array<string|int, mixed>
$suffixNodes
= []
Methods
__construct()
public
__construct(RecordInterface|ResourceInterface|null $mainContext[, array<string|int, BreadcrumbNode> $suffixNodes = [] ]) : mixed
Parameters
- $mainContext : RecordInterface|ResourceInterface|null
-
The main entity (record or resource)
- $suffixNodes : array<string|int, BreadcrumbNode> = []
-
Additional nodes to append after the main breadcrumb trail
hasContext()
Checks if this context has a valid main entity.
public
hasContext() : bool
Return values
boolhasSuffixNodes()
Checks if this context has suffix nodes.
public
hasSuffixNodes() : bool