Seams final class
Minn\Extension\Seams · public/minn/src/Minn/Extension/Seams.php · 145 lines
Where an extension can take part in a request: eight typed registrations, the request they run in, and the outgoing HTTP its minn.json asks for. This is the whole surface an extension sees. Each extension registers on its own (forExtension), and what it registered joins the request's once its register() returns (adopt). The engine calls what was registered through SeamRunner, at the right moment and in registration order.
Constants and properties
| private | array $blockGates | |
| private | array $blockFilters | |
| private | array $shortcodes | |
| private | array $contentFilters | |
| private | array $head | |
| private | array $footer | |
| private | array $bodyClasses | |
| private | array $documentFilters | |
| private | ?Closure $title | |
| prop | readonly Minn\Http $http | Outgoing HTTP, bound to the hosts the extension's needs.http lists; a client that throws when it asked for none. |
| prop | readonly Minn\Db $db | Promoted from the constructor. |
| prop | readonly Minn\Content\Site $site | Promoted from the constructor. |
| prop | readonly Minn\Http\Request $request | Promoted from the constructor. |
| prop | readonly Minn\Content\Reader $reader | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db, Minn\Content\Site $site, Minn\Http\Request $request, Minn\Content\Reader $reader, ?Minn\Http $http = NULL)# | |
| method | forExtension(Minn\Extension\Manifest $manifest): self# | The seams one extension registers on: this request, and the outgoing HTTP its manifest grants. A manifest without needs.http gets a client that throws at its first request, naming the key to add. |
| method | adopt(self $extension): void# | Takes on what one extension registered, after its register() returned, so an extension that throws half-way adds nothing. A closure the engine hands seams to is handed that extension's own. |
| method | gateBlocks(Closure $gate): void# | Decides whether a block renders at all; the first gate to answer false wins. |
| method | filterBlocks(Closure $filter): void# | Rewrites a block's rendered markup. |
| method | shortcode(string $tag, Closure $render): void# | Renders [tag attr="…"]content[/tag] wherever it appears in post content. |
| method | filterContent(Closure $filter): void# | Rewrites rendered post content (after blocks and shortcodes). |
| method | head(Closure $render): void# | Markup for the document head (a style, a meta tag, a script). |
| method | footer(Closure $render): void# | Markup before </body>. |
| method | bodyClass(string $class): void# | Adds a body class. |
| method | title(Closure $filter): void# | Replaces the document title; receives the engine's own. |
| method | filterDocument(Closure $filter): void# | Rewrites the whole themed document before it is sent (what an output buffer did on the reference). |
| method | registrations(): Minn\Extension\Registrations# | What was registered, for the engine's runner. Extensions have no reason to call this. |
Nothing matches.