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

Pages

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

class

Pages

Pages.php:40

The pages built from sections: what the backoffice does with them, whoever asks (its routes,

class MMO\editor\cms\Pages extends MMO\core\classes\aModule
Espace de noms
MMO\editor\cms
Étend
aModule
Voir
PagesController, or the application's code).
The methods taking a client first act **for** it, and check its rights: the `editor.pages` scopes of mmo.oauth, `#edit` to change a page's draft (and make or delete a page), `#publish` to publish it, take it offline or roll it back. A page's own scope narrows them: `editor.pages.{id}#edit`. A client without the right gets [`eForbidden`](https://mmoframework.fr/fr/documentation/mmo.editor/php/exceptions/eForbidden.md#eforbidden). Configuration: ```json "MMO\\editor\\cms\\Pages": { "repositories": {"main": {"$": "#repository"}}, "templates": ["{root}/templates/cms"], "revisions": 20 } ``` with the repository holding `pages` ([`Page`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/Page.md#page)) and `pageRevisions` ([`PageRevision`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/PageRevision.md#pagerevision)) collections. The `templates` folders hold the application's `layouts.phtml` and `sections.{phtml,schema.json}`, before mmo.editor's own (`templates/`, [`TEMPLATES`](https://mmoframework.fr/fr/documentation/mmo.editor/php/cms/Pages.md#pages-templates)).
$pages = Pages::Shared(); $page = $pages->createPage($user, ['slug' => 'home', 'title' => 'Home', 'sections' => [$pages->newSection('hero')]]); $pages->publish($user, $page);

Index

EDITthe right to change a page's draft, make a page, delete one
FIELDSthe fields of a page a client sends
PUBLISHthe right to publish a page, take it offline, roll it back
TEMPLATESmmo.editor's own layouts and sections, after the application's
VERSIONthe fields of a version of a page: what is published, kept as a revision, rendered (Page::exportDraft)
repositories
revisions
scope
templates
types
typesFolder
typesScope
authorOf($client)
can($client, $action, $page)
canEditTypes($client)
check($client, $action, $page)
checkTypes($client)
cleanDraft($input, $page, $whole)What a client sent for a page, made what the page holds: the html sanitized, every section checked against its type -- or nothing at all.
cleanTranslations($languages, $sections, $translations, $errors)What a client sent of a page's translations, made what the page holds: one per language but the default one, only their texts (Translations::Strip), the html sanitized, each section translated…
cleanVersion($page, $version)A version of a page that is not saved (a preview's), made what a draft would hold: the html sanitized, every section checked against its type.
collection($class)
commit($entity)Save the changes, and make sure $entity was: a commit only says what it did not save
createPage($client, $input)Make a page, for $client (who needs EDIT on every page): its draft only, until it is published.
deletePage($client, $page)Delete $page and its revisions, for $client (who needs EDIT and PUBLISH on it)
getPage($id)
getPageBySlug($slug)
getPageCollection()
getPages()
getRevisionCollection()
getRevisions($page)
getSectionTypes()
getTypesFolder()
newSection($type)
onScopes($request)The rights of the pages, for the screens granting scopes
pruneRevisions($page, $new)Keep the last $revisions revisions of $page, $new included: the others go, with the next commit
publish($client, $page)Publish the draft of $page, for $client: it becomes what visitors see, and a revision of the page.
remove($entity)
render($version, $mode, $document, $language)Render a version of a page (Page::exportDraft, or a page's published)
resetSectionTypes()Read the types again: one was written, or removed (SectionTypeStore)
rollback($client, $page, $number)Copy the revision $number of $page into its draft, for $client (who needs PUBLISH): the draft it replaces is lost, what visitors see is unchanged until it is published.
saveDraft($client, $page, $input)Change the draft of $page, for $client: only the fields given, and only when all of them are valid.
setRepositories($repositories)
unpublish($client, $page)Take $page offline, for $client: visitors no longer see it, its draft and its revisions stay

Constantes5

EDIT

the right to change a page's draft, make a page, delete one

const EDIT = 'edit'

FIELDS

the fields of a page a client sends

const FIELDS = […7 items]

PUBLISH

the right to publish a page, take it offline, roll it back

const PUBLISH = 'publish'

TEMPLATES

mmo.editor's own layouts and sections, after the application's

const TEMPLATES = '{mmo.editor}/templates'

VERSION

the fields of a version of a page: what is published, kept as a revision, rendered (Page::exportDraft)

const VERSION = ['title', 'layout', 'seo', 'sections', 'languages', 'translations']

Propriétés7

repositories

#[MMO\core\attributes\Serialize(unserialize: 'setRepositories')] protected array $repositories = []
Type
array

revisions

int $revisions = 20
Type
int

scope

string $scope = 'editor.pages'
Type
string

templates

array $templates = []
Type
array

types

#[MMO\core\attributes\Serialize(false)] protected ?MMO\editor\cms\SectionTypes $types = null
Type
null | SectionTypes

typesFolder

?string $typesFolder = null
Type
null | string

typesScope

string $typesScope = 'editor.sections'
Type
string

Méthodes31

authorOf($client)

Pages.php:443
protected function authorOf(?MMO\oauth\interfaces\iClient $client): string
$clientnull | iClient
retournestringwhat a revision says of who published it

can($client, $action, $page)

Pages.php:94
function can( ?MMO\oauth\interfaces\iClient $client, string $action, ?MMO\editor\cms\Page $page = null ): bool
$clientnull | iClient
$actionstring
$page = nullnull | Page
retourneboolwhether $client may do $action (EDIT, PUBLISH) with $page, or with every page

canEditTypes($client)

Pages.php:254
function canEditTypes(?MMO\oauth\interfaces\iClient $client): bool
$clientnull | iClient
retourneboolwhether $client may write the site's section types ($typesScope)

check($client, $action, $page)

Pages.php:101
function check( ?MMO\oauth\interfaces\iClient $client, string $action, ?MMO\editor\cms\Page $page = null ): void
$clientnull | iClient
$actionstring
$page = nullnull | Page
retournevoid
lèveunless $client may do $action with $page

checkTypes($client)

Pages.php:259
function checkTypes(?MMO\oauth\interfaces\iClient $client): void
$clientnull | iClient
retournevoid
lèveunless $client may write the site's section types

cleanDraft($input, $page, $whole)

Pages.php:307

What a client sent for a page, made what the page holds: the html sanitized, every section checked against its type -- or nothing at all.

protected function cleanDraft(array $input, ?MMO\editor\cms\Page $page = null, bool $whole = false): array
$inputarray
$page = nullnull | Pagethe page it changes, null for a new one
$whole = falsebooltrue when $input is a whole version (one being published)
retournearraymixed>
lèvewith what is wrong, field by field

cleanTranslations($languages, $sections, $translations, $errors)

Pages.php:402

What a client sent of a page's translations, made what the page holds: one per language but the default one, only their texts (Translations::Strip), the html sanitized, each section translated checked against its type.

protected function cleanTranslations(array $languages, array $sections, array $translations, array &$errors): array
$languagesarraythe page's, the default one first
$sectionsarray
$translationsarray
$errorsarray
retournearrayarray<string, mixed>>

cleanVersion($page, $version)

Pages.php:292

A version of a page that is not saved (a preview's), made what a draft would hold: the html sanitized, every section checked against its type.

function cleanVersion(MMO\editor\cms\Page $page, array $version): array
$pagePagethe page it is a version of
$versionarray
retournearraymixed>
lèvewith what is wrong

commit($entity)

Pages.php:467

Save the changes, and make sure $entity was: a commit only says what it did not save

protected function commit(MMO\core\interfaces\iEntity $entity): void
$entityiEntity
retournevoid

createPage($client, $input)

Pages.php:151

Make a page, for $client (who needs EDIT on every page): its draft only, until it is published.

function createPage(?MMO\oauth\interfaces\iClient $client, array $input): MMO\editor\cms\Page
$clientnull | iClient
$inputarray
retournePage
lèvewith what is wrong

deletePage($client, $page)

Pages.php:226

Delete $page and its revisions, for $client (who needs EDIT and PUBLISH on it)

function deletePage(?MMO\oauth\interfaces\iClient $client, MMO\editor\cms\Page $page): void
$clientnull | iClient
$pagePage
retournevoid

getRevisionCollection()

Pages.php:127
function getRevisionCollection(): MMO\core\entities\Collection
retourneCollection

getRevisions($page)

Pages.php:203
function getRevisions(MMO\editor\cms\Page $page): array
$pagePage
retournearraythe revisions kept of $page, the last one first

newSection($type)

Pages.php:267
function newSection(string $type): array
$typestring
retournearraystring, type: string, data: array<string, mixed>} a new section of $type, with its defaults
lèvewhen there is no such type

onScopes($request)

Pages.php:109

The rights of the pages, for the screens granting scopes

#[MMO\core\attributes\Listen('MMO\\oauth\\events\\ScopesList')] function onScopes(MMO\oauth\events\ScopesList $request): void
$requestScopesList
retournevoid

pruneRevisions($page, $new)

Pages.php:437

Keep the last $revisions revisions of $page, $new included: the others go, with the next commit

protected function pruneRevisions(MMO\editor\cms\Page $page, MMO\editor\cms\PageRevision $new): void
$pagePage
$newPageRevision
retournevoid

publish($client, $page)

Pages.php:180

Publish the draft of $page, for $client: it becomes what visitors see, and a revision of the page.

function publish(?MMO\oauth\interfaces\iClient $client, MMO\editor\cms\Page $page): MMO\editor\cms\PageRevision
$clientnull | iClient
$pagePage
retournePageRevision
lèvewhen the draft is no longer valid (a section type that went away...)

remove($entity)

Pages.php:448
protected function remove(MMO\core\interfaces\iEntity $entity): void
$entityiEntity
retournevoid

render($version, $mode, $document, $language)

Pages.php:279

Render a version of a page (Page::exportDraft, or a page's published)

function render( array $version, string $mode = MMO\editor\cms\PageRenderer::PUBLIC, ?MMO\core\documents\HtmlDocument $document = null, ?string $language = null ): MMO\core\documents\HtmlDocument
$versionarray
$mode = MMO\editor\cms\PageRenderer::PUBLICstringPageRenderer::PUBLIC, PREVIEW, EDIT
$document = nullnull | HtmlDocument
$language = nullnull | stringone of the version's languages: its texts translated, the default language's where they are not (Translations::Version); null: the default language
retourneHtmlDocument

rollback($client, $page, $number)

Pages.php:212

Copy the revision $number of $page into its draft, for $client (who needs PUBLISH): the draft it replaces is lost, what visitors see is unchanged until it is published.

function rollback( ?MMO\oauth\interfaces\iClient $client, MMO\editor\cms\Page $page, int $number ): MMO\editor\cms\Page
$clientnull | iClient
$pagePage
$numberint
retournePage
lève(404) when the page has no such revision (any more)

saveDraft($client, $page, $input)

Pages.php:168

Change the draft of $page, for $client: only the fields given, and only when all of them are valid. The html of the sections is sanitized, the sections without an id get one.

function saveDraft( ?MMO\oauth\interfaces\iClient $client, MMO\editor\cms\Page $page, array $input ): MMO\editor\cms\Page
$clientnull | iClient
$pagePage
$inputarray
retournePage
lèvewith what is wrong, leaving the page as it was

setRepositories($repositories)

Pages.php:84
function setRepositories(array $repositories): void
$repositoriesarray
retournevoid

unpublish($client, $page)

Pages.php:195

Take $page offline, for $client: visitors no longer see it, its draft and its revisions stay

function unpublish(?MMO\oauth\interfaces\iClient $client, MMO\editor\cms\Page $page): MMO\editor\cms\Page
$clientnull | iClient
$pagePage
retournePage
Membres hérités (48)
ConstantesDéclaré parDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropriétésDéclaré parDescription
verbosityaModule
MéthodesDéclaré parDescription
alert($message, $context)aModuleAction must be taken immediately.
backtraces($message, $context)aModuleForce-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
Configure($config)aModuleMerge $config into this module's configuration in the shared Configuration.
critical($message, $context)aModuleCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aModuleDetailed debug information.
debugName()aModuleHuman-readable identifier used as the default {origin} in this instance's log messages.
DefaultConfig()aModuleThe config a module starts from before anything loaded via Configuration is merged in.
emergency($message, $context)aModuleSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aModuleRuntime errors that do not require immediate action but should typically be logged and monitored.
getVerbosity()aModule
info($message, $context)aModuleInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
Instantiate($config)aModule(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()aModule
log($level, $message, $context)aModuleLogs with an arbitrary level.
notice($message, $context)aModuleNormal but significant events.
offsetExists($key)aModule\ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access.
offsetGet($key)aModule\ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g.
offsetSet($key, $value)aModule\ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g.
offsetUnset($key)aModule\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setVerbosity($verb)aModuleSet the current verbosity mask, replacing whatever it was before.
Shared()aModuleGet the shared instance, creating (and configuring) it on first call.
testVerbosity($level)aModuleTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
traitUnshare($serialize)aModuleRemove the shared instance, so the next Shared() call creates a fresh one.
unserialize($data, $path, $instances)aModule\MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via
Unshare($serialize)aModuleLike tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it.
warning($message, $context)aModuleExceptional occurrences that are not errors.
__construct($config)aModuleprotected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.