ComponentContext
The ambient, render-target-agnostic context a component is mounted/rendered within — its identity plus request-scoped facts (principal, locale, route) it may need but does not own. Passed alongside props to {@see \Milpa\Live\Contracts\Component\ComponentDefinitionInterface::mount()} so mount-time logic can depend on "who is asking" without every component needing its own principal/locale plumbing.
ComponentContext::__construct()
public function __construct(string $componentId, ?string $principal = null, ?string $locale = null, ?string $route = null, array $meta = []):Parameters
| Name | Type | Description |
|---|---|---|
| $componentId | string | The component instance's unique id within the page/response. |
| $principal | (string | null) | The requesting {@see SecurityPrincipal}'s id, if authenticated. |
| $locale | (string | null) | The request's locale, if the caller resolved one. |
| $route | (string | null) | The current route/URL, for components that need it (e.g. active-nav state). |
| $meta | array<string, mixed> | Caller-defined extra context beyond the fields above. |