View Slot Registry
A shared registry for named View Slots, allowing independent application components to collect, retrieve and organize rendered views before their final output.
Purpose
Each View Slot is registered in its own registry under a unique key. Other application components can retrieve the same slot by its key and contribute rendered content without needing to know which component originally created it.
The registry is available during the current APPNETOS runtime. Applications can therefore
create View Slots before final rendering, retrieve existing slots and manage their contents
across multiple UI components. This is especially useful for dedicated Core\Ui
elements, framesets, navigation regions, sidebars and other layout areas that aggregate
rendered views into a single output view.
Registration and composition
- An application component creates a View Slot with a unique key. The View Slot registers itself in the shared View Slot Registry.
- Other components check for the slot using
has()or retrieve it usingget(). - Components contribute already rendered content through
prepend()orappend(). If the key does not exist, these methods create the slot automatically. - The collected content is synchronized with the render variable container and can be inserted into the final UI or layout view.
Keys are unique within the current runtime. Explicitly registering a second
View Slot with an existing key raises a ViewSlotRegistryException.
Public API Reference
Core\Render\ViewSlotRegistry
Class & Registry
Class:
Core\Render\ViewSlotRegistry
Extends:
Core\Render\ViewSlotRegistry\Base
use Core\Render\ViewSlotRegistry;
use Core\Registry;
$viewSlotRegistry = Registry::get(ViewSlotRegistry::class);
| Method | Description |
|---|---|
get(string $key): ViewSlot|null |
Returns the View Slot registered under the specified key, or null
if the key is not registered.
|
has(string $key): bool |
Checks whether a View Slot exists for the specified key. |
add(ViewSlot $viewSlot): void |
Registers a View Slot using its own key. Rejects duplicate keys by throwing
ViewSlotRegistryException.
|
prepend(string $key, string $view): ViewSlot |
Adds rendered content before the existing slot content. Automatically creates and registers a new View Slot when the key does not yet exist; returns the slot. |
append(string $key, string $view): ViewSlot |
Adds rendered content after the existing slot content. Automatically creates and registers a new View Slot when the key does not yet exist; returns the slot. |