APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

View Slots

View Slots collect already rendered views, preserve their intended order, and make the combined content available for output inside dedicated UI views.

Purpose

View Slots are primarily used by specialized Core\Ui elements. Instead of rendering every fragment directly at its original location, an element can collect rendered fragments in a named slot and output them together later within a designated view.

A View Slot stores rendered content rather than rendering templates itself. Content can be replaced, prepended, or appended to control its position in the aggregated result.

View aggregation flow

Multiple views are rendered individually and collected in a View Slot. The slot determines the order of their rendered output. A specialized UI view can then include the aggregated content at the appropriate location.

Diagram showing individually rendered views collected and ordered in a View Slot, then displayed together inside a Core UI view
Rendered views are collected and ordered before being inserted into a dedicated UI view.

Ordering and output

Use setView() to set or replace the slot content, prepend() to place additional rendered content before it, and append() to place content after it. The resulting content can be retrieved with getView() and is synchronized with the rendering variable container when updated.

Public API Reference

Core\Render\ViewSlot

Class & Registry

Class: Core\Render\ViewSlot

Extends: Core\Render\ViewSlot\Base

use Core\Render\ViewSlotRegistry;
use Core\Registry;

$viewSlotRegistry = Registry::get(ViewSlotRegistry::class);
$viewSlot = $viewSlotRegistry->get('view-slot-key");
Method Description
public function getView(): string Returns the rendered content currently stored in the View Slot.
public function setView(string $view): void Replaces the slot content with the supplied rendered view and synchronizes the updated value with the render variable container.
public function prepend(string $view): void Inserts the supplied rendered content before the existing slot content, separating both parts with the platform line ending.
public function append(string $view): void Inserts the supplied rendered content after the existing slot content, separating both parts with the platform line ending.

Next Steps

Previous

Variables

Explore Variables

Next

View Slot Registry

Explore View Slot Registry