Container
Group multiple content components into one reusable structure and include them across different URIs.
Purpose
A Container is a reusable collection of content items. Instead of adding the same set of components to every URI separately, APPNETOS lets you define the group once and reference that container as a single content item wherever it is needed.
A container can combine different supported content types, including Apps, static HTML, Templates, Assets and Fragments. Its items are initialized in their stored order, allowing a consistent composition to be reused across multiple pages.
Common use cases
Containers are especially useful for UI elements that appear repeatedly across a website or administration interface. A shared page-start container, for example, might group:
- Navbar: the main navigation App.
- Breadcrumbs: a navigation trail reflecting the current page.
- Session Indicator: an App showing session-related information.
- Additional content: reusable HTML, Templates or registered CSS and JavaScript Assets.
Each URI only needs to reference the container. The shared composition can then be maintained in its container document instead of being duplicated across URI documents.
Initialization and rendering
- The URI content list references a container content item by its document ID.
- The Container handler loads the active container document from the mapped collection.
- The stored nested content list is validated; direct container entries are rejected.
- A separate
Core\Contentcontroller is created usingRegistry::getNew(Content::class). - The nested controller is initialized with the container's content items in their original order.
- The resulting nested views are collected by the content/rendering pipeline alongside other URI content.
The Container handler does not render a combined HTML string itself. It delegates content
initialization to its own Core\Content instance; the nested handlers and the
APPNETOS rendering layer are responsible for producing and collecting the output.
Nesting restriction: the current implementation rejects a content item of type
container inside a container. This prevents direct recursive container composition.
Public API Reference
Core\Content\Container
Class & Registry
Class:
Core\Content\Container
Extends:
Core\Content\Container\Base
use Core\Content\Container;
use Core\Registry;
$container = Registry::get(Container::class);
| Method | Description |
|---|---|
init(array $item): void |
Load the referenced container document and initialize its nested content using a new
Core\Content
instance.
|
getItem(): array |
Return the normalized URI content item that references this container. |
getId(): ObjectId|null |
Return the container document ID extracted from the content item. |
getData(): array |
Return the data attached to the referencing content item. |
getDocument(): object|null |
Return the loaded container document, if available. |
getContent(): Content|null |
Return the separately initialized nested Core\Content controller, or
null before initialization.
|