class Document implements Renderable
A view which renders a HTML skeleton for Flarum's frontend app.
Properties
| string|null | $title | The title of the document, displayed in the <title> tag. |
|
|
| string|null | $language | The language of the document, displayed as the value of the attribute `lang` in the <html> tag. |
|
|
| string|null | $direction | The text direction of the document, displayed as the value of the attribute `dir` in the <html> tag. |
|
|
| string | $appView | The name of the frontend app view to display. |
|
|
| string | $layoutView | The name of the frontend layout view to display. |
|
|
| string | $contentView | The name of the frontend content view to display. |
|
|
| string| Renderable|null | $content | The SEO content of the page, displayed within the layout in <noscript> tags. |
|
|
| array | $payload | Other variables to preload into the Flarum JS. |
|
|
| array | $meta | An array of meta tags to append to the page's <head>. |
|
|
| string|null | $canonicalUrl | The canonical URL for this page. |
|
|
| int|null | $page | Which page of content are we on? |
|
|
| bool|null | $hasNextPage | Is there a next page? |
|
|
| array | $head | An array of strings to append to the page's <head>, rendered *after* the forum/admin stylesheet so that user-supplied <style>/<link> blocks correctly override core CSS. |
|
|
| array | $preHead | An array of strings to render in <head> *before* the forum/admin stylesheet. Use this for hints and scripts that must take effect before first paint — preconnect hints to additional origins, an inline script that sets data-theme on <html>, etc. |
|
|
| string | $criticalCss | Inline critical CSS emitted before the main stylesheet link. |
|
|
| array | $foot | An array of strings to prepend before the page's </body>. |
|
|
| array | $js | An array of JavaScript URLs to load. |
|
|
| array | $css | An array of CSS URLs to load. |
|
|
| array | $preloads | An array of preloaded assets. |
|
|
| array<string, string| Closure| array> | $extraAttributes | Document extra attributes. A Closure value is called with the request; any other value is used as given. |
|
Methods
__construct( Factory $view, array $forumApiDocument, ServerRequestInterface $request, TitleDriverInterface $titleDriver, Config $config, VersionerInterface $versioner, Factory $filesystem)
No description
void
preloadChunk(string $namespace, string $path)
Preload a JavaScript chunk the page imports as soon as it boots, so it downloads alongside the main bundle rather than after it.
static string
setQueryParam(string $url, string $key, string|null $value)
Set or override a query param on a string URL to a particular value.
Details
at
line 170
__construct( Factory $view, array $forumApiDocument, ServerRequestInterface $request, TitleDriverInterface $titleDriver, Config $config, VersionerInterface $versioner, Factory $filesystem)
at
line 184
string
render()
at
line 198
void
preloadChunk(string $namespace, string $path)
Preload a JavaScript chunk the page imports as soon as it boots, so it downloads alongside the main bundle rather than after it.
at
line 230
protected string
makeTitle()
at
line 249
protected array
makePreloads()
at
line 262
protected array
makeExtraClasses()
at
line 281
protected string
makeExtraAttributes()
at
line 308
protected array
makePreconnects()
at
line 343
protected string
makeHead()
at
line 419
protected string
makeJs()
at
line 426
protected string
makeFoot()
at
line 431
array
getForumApiDocument()
at
line 436
void
setForumApiDocument(array $forumApiDocument)
at
line 441
static string
setPageParam(string $url, int|null $page)
at
line 453
static protected string
setQueryParam(string $url, string $key, string|null $value)
Set or override a query param on a string URL to a particular value.