Content
Loads and initializes content items in the order defined by the global URI document and passes their collected views to the rendering pipeline.
Purpose
Loads and initializes content items in the order defined by the global URI document and passes their collected views to the rendering pipeline.
Content lifecycle
By default, APPNETOS obtains the content definitions for the current request from the global URI
document. The Core\Content controller processes the entries in their document-defined
order, initializes the corresponding content handlers individually, and collects their views for the
Render component.
- Load: Read the content definitions associated with the resolved global URI document.
- Order: Preserve the sequence defined in that document.
- Initialize: Resolve and initialize each content item through its matching content handler.
- Collect: Obtain the views from the initialized handlers, including views from nested content structures where applicable.
- Render: Pass the ordered collection of views to the rendering pipeline for output.
This separation allows different content types to participate in a single page while keeping their initialization and view generation independent.
Content Context
APPNETOS provides an optional content context mechanism that allows runtime controllers to access information about their originating content item without depending on the corresponding content handler.
A Core\Content\ContentContext contains the normalized content type, MongoDB content
identifier and content-specific data. Controllers can receive this information by implementing
Core\Content\ContentAwareInterface.
Content context injection is currently implemented for regular App controller initialization. Other content types may adopt the same mechanism where controller initialization is supported.
The mechanism is particularly useful for reusable components, nested content structures and multiple instances of the same controller that require independent runtime configuration.
Public API Reference
Core\Content
Class & Registry
Class:
Core\Content
Extends:
Core\Content\Base
use Core\Content;
use Core\Registry;
$content = Registry::get(Content::class);
| Method | Description |
|---|---|
public function getTypes(): array |
Get supported content types |
public function getContent(): array |
Get raw content items |
public function getItems(): array |
Get normalized content items |
public function getHandlers(): array |
Get initialized content handlers |
public function getViews(): array |
Get rendered views Collects directly rendered handler views and recursively resolves views from nested Core\Content instances. |
Context implementations
APPNETOS provides application and administration implementations of this controller. Use the class mapped for the active runtime context; shared base classes describe common behavior, while concrete implementations may supply context-specific dependencies.