ContentComponent
Readable entries — the smallest declaration that lets a house paint narrative content (greenhouse decisions/0464). It knows nothing of what the rows ARE. It knows ROLES: which field is read as the title, which as the body, and optionally which as the lead and which as metadata. The same declaration paints an article, a notice, a changelog entry or a help page, and a new kind of row needs no new code — that is the test this primitive exists to pass. `rows` is the prop a screen binding fills, so a declared screen can bind this to an entity's public rows exactly as it binds a table. The body is plain text: a blank line separates paragraphs and everything is escaped. A body that could carry markup is a separate security question, not a smaller one.
ContentComponent::contract()
public static function contract(): Milpa\Live\ValueObjects\ComponentContractThe contract: rows and the roles that read them; no actions — reading needs no round trip.
ContentComponent::mount()
public function mount(array $props, Milpa\Live\ValueObjects\ComponentContext $context): Milpa\Live\ValueObjects\StateSnapshotMounts after checking the roles; a declaration that names no title or body is refused here.
Parameters
| Name | Type | Description |
|---|---|---|
| $props | array | |
| $context | Milpa\Live\ValueObjects\ComponentContext |
ContentComponent::handle()
public function handle(Milpa\Live\ValueObjects\InteractionRequest $request): Milpa\Live\ValueObjects\InteractionResultNothing to do: an entry is read, not operated.
Parameters
| Name | Type | Description |
|---|---|---|
| $request | Milpa\Live\ValueObjects\InteractionRequest |
ContentComponent::roles()
public static function roles(?mixed $roles): arrayThe roles, checked: `title` and `body` name a field, `lead` may, `meta` is a list of fields.
Parameters
| Name | Type | Description |
|---|---|---|
| $roles | ?mixed |
ContentComponent::rows()
public static function rows(?mixed $rows, array $roles): arrayThe rows, checked against the roles: a role that names a field the rows do not carry is refused, because an entry painted without its title reads as a broken page and not as a wrong declaration.
Parameters
| Name | Type | Description |
|---|---|---|
| $rows | ?mixed | |
| $roles | array{title: string, body: string, lead: ?string, meta: list<string>} |
ContentComponent::paragraphs()
public static function paragraphs(?mixed $body): arrayA body as paragraphs: a blank line separates them, and single line breaks are kept within one.
Parameters
| Name | Type | Description |
|---|---|---|
| $body | ?mixed |
Returns
paragraphs, each a list of lines