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

TopContent

A lightweight layout for navigation or toolbars above a sequence of page views.

CoreUi\Frameset\TopContent provides the Top + Content layout. Unlike Core Apps, Core UI elements provide reusable controllers and templates without their own translations.

Layout regions

Diagram of the top-content frameset, showing its layout regions and render variables
The top-content layout: frameset_top and content[].

Named regions are populated from shared render variables via ViewSlots. The main content[] region is a collection of rendered views passed by the Core Render controller, not a ViewSlot. Twig outputs these views with |raw. Optional regions are omitted when empty.

Rendering architecture

Architecture diagram showing Core Render, the ContentRendererInterface, ViewSlotRegistry, render variables, and final frameset Twig output
Frameset content and named ViewSlots follow separate paths into the final Twig template.

Integration with Core Render

Framesets implement Core\Render\Interface\ContentRendererInterface. An application context can select a frameset by overriding getContentRenderer() in its mapped Render controller. When no explicit template stack is registered, Core\Render::send() calls init(), passes the collected content through setContent(), and returns getView() (optionally compressed).

#[Shared]
class Render extends CoreRender
{
    protected function getContentRenderer(): object|null
    {
        return Registry::get(TopContent::class);
    }
}

Replace TopContent with the selected class and import Core\Registry, Core\Render as CoreRender and Core\Annotation\Shared. APPNETOS Docs uses this approach with TopContentBottom.

ViewSlot lifecycle

Components render their own HTML and contribute it to named regions through Core\Render\ViewSlotRegistry. Calling prepend() or append() creates a missing slot automatically. Each new ViewSlot registers itself with the shared registry and synchronizes its rendered string into Core\Render\Variables under the slot key. Subsequent updates synchronize the same variable.

$slots = Registry::get(ViewSlotRegistry::class);
$slots->append('frameset_top', $renderedNavigation);

Import Core\Render\ViewSlotRegistry and Core\Registry. Each key identifies one registered slot; direct duplicate registration through add() is rejected. Slot contents are already rendered HTML and are emitted with Twig's |raw filter. Only add trusted, correctly escaped output.

Rendering lifecycle and customization

The frameset's init() resolves required controllers. setContent(array $content) replaces the content view list, addContent(string $view) appends one rendered view, and getView() renders the Twig layout through Core\Render::load(). The result is cached per frameset instance after its first getView() call; populate all slots and content before rendering.

The frameset template extends appnetos/shared/templates/base.html.twig and overrides its body block. Adapt layout through the documented protected template hooks in a custom implementation, or through APPNETOS template overrides.

Template and implementation details

Default template: appnetos/shared/ui/frameset/top-content/templates/top-content.html.twig. The protected getBaseTemplate() method selects this template.

Next Steps

Previous

Frameset

Explore Frameset

Next

Top Content Bottom

Explore Top Content Bottom