MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

PageRenderer

MMO\editor\cms · 1 symbole · générée le 27 Oct 2026

class

PageRenderer

PageRenderer.php:27

Render a version of a page (Page::exportDraft, Page::getPublished) into an html document: each section by its template (sections/{type}.phtml), then the page's layout (layouts/{layout}.phtml) around them.

class MMO\editor\cms\PageRenderer
Espace de noms
MMO\editor\cms
The same templates render the three places a page is seen, which only [`SectionFields`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/SectionFields.md#sectionfields) tells apart: - [`PUBLIC`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/PageRenderer.md#pagerenderer-public) the page visitors see; - [`PREVIEW`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/PageRenderer.md#pagerenderer-preview) the backoffice's preview: every section says which it is (`data-section`), for the form to find it; - [`EDIT`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/PageRenderer.md#pagerenderer-edit) the expert level: the fields are editable in place (`$f->edit()`), the sections inside an `<mmo-editor inline>`, whose `change` events say which field changed (`data-path`). A section template is given `$_VARS['f']` (its [`SectionFields`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/SectionFields.md#sectionfields)), `section` (`{id, type, data}`) and `page` (the version). A layout is given `page`, `content` (the sections' html, ready to print: with their styles -- every template folder's `sections/sections.css` --, wrapped in the editor at the expert level), `sections` (each `{id, type, html}`, for a layout placing them itself) and `renderer` (this).
$document = (new PageRenderer(Pages::Shared()->getSectionTypes()))->render($page->getPublished()); return Response::Html($document);

Constantes3

EDIT

const EDIT = 'edit'

PREVIEW

const PREVIEW = 'preview'

PUBLIC

const PUBLIC = 'public'

Propriétés3

mode

readonly
readonly string $mode
Type
string

sanitizer

protected MMO\editor\cms\Sanitizer $sanitizer
Type
Sanitizer

types

readonly
protected readonly MMO\editor\cms\SectionTypes $types
Type
SectionTypes

Méthodes4

render($version, $document)

PageRenderer.php:43
function render(array $version, ?MMO\core\documents\HtmlDocument $document = null): MMO\core\documents\HtmlDocument
$versionarray
$document = nullnull | HtmlDocumentthe document to render in, a new one (dressed by the theme) otherwise
retourneHtmlDocument
lèvewhen the page's layout, and the default landing one, cannot be found

renderSection($section, $version, $document)

PageRenderer.php:95
function renderSection( array $section, array $version, MMO\core\documents\HtmlDocument $document ): string
$sectionarray
$versionarray
$documentHtmlDocument
retournestringits html: nothing on the public page for a type that no longer exists, a placeholder elsewhere