Portals
extends PlatformUtility
in package
Generic HTML portal accumulator.
Provides a slot-based mechanism for collecting arbitrary HTML content from anywhere in the template tree and flushing it at a designated injection point — independent of render order.
Lifecycle:
- {Portal name="nav"} calls add('nav', $html, $id) during body render
- {Portal name="nav" output=true} calls inject('nav') → emits portal_nav
- parseTemplateBlocks() resolves portal_nav by invoking the registered callback, which flushes the accumulated HTML wrapped in a marker
Tags
Table of Contents
- add() : void
- Accumulate raw HTML into a named slot.
- inject() : string
- Register a Smarty injection point for the slot and return the token.
Methods
add()
Accumulate raw HTML into a named slot.
public
add(string $slot, string $html[, string $id = '' ]) :
void
Parameters
- $slot : string
-
Slot name, e.g. "styles", "nav-primary", "drawers"
- $html : string
-
Raw HTML to append to the slot
- $id : string = ''
-
Optional dedup key — subsequent calls with the same id are silently ignored
Tags
Return values
void —inject()
Register a Smarty injection point for the slot and return the token.
public
inject(string $slot) :
string
All slots use the generic portal.tpl, which flushes the accumulated HTML via get($slot). The token is replaced after the full template render by parseTemplateBlocks().
Parameters
- $slot : string