MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

Section

MMO\editor\cms · 1 symbol · generated 27 Oct 2026

class

Section

Section.php:20

One section of a page (Page::$sections): its type names the template rendering it (sections/{type}.phtml) and the schema its data follows (sections/{type}.schema.json, SectionTypes).

class MMO\editor\cms\Section extends MMO\core\entities\EmbeddedEntity
Namespace
MMO\editor\cms
Extends
EmbeddedEntity
- `id` names it in the page for as long as it lives (a `data-section` of the preview, a `data-path` of the expert level): it is made when the section is, and kept when the sections are reordered. - `data` is what its schema says: text, html (sanitized when it is saved, [`Pages::saveDraft`](https://mmoframework.fr/en/documentation/mmo.editor/php/cms/Pages.md#pages-savedraft)), links, images...
$page->set('sections', [['type' => 'hero', 'data' => ['title' => 'A desk by the Saône']]]); $page->get('sections')[0]->getType(); // 'hero'

Index

data
idWhat names the section in its page: letters, digits, - and _ (made when the section is).
typeThe section's type: its template and its schema.
export()
getData()
getSectionId()
getType()
NewId() static
__construct($parent, $key, $data)

Properties3

data

#[MMO\core\attributes\ArrayProperty()] protected array $data = []
Type
array

id

What names the section in its page: letters, digits, - and _ (made when the section is).

#[MMO\core\attributes\ArrayProperty()] protected string $id = ''
Type
string

type

The section's type: its template and its schema.

#[MMO\core\attributes\ArrayProperty()] protected string $type = ''
Type
string

Methods6

export()

Section.php:63
function export(): array
returnsarraystring, type: string, data: array<string, mixed>} what a page's version keeps of it

NewId()

staticSection.php:45
static function NewId(): string
returnsstringa new section's id: short, and unlikely to be one of its page's already

__construct($parent, $key, $data)

Section.php:39
function __construct(MMO\core\interfaces\iEntity $parent, string $key, array $data = [])
$parentiEntity
$keystring
$data = []array
Inherited members (99)
ConstantsDeclared byDescription
FLAG_CHANGEDiEntity
FLAG_CREATEDiEntity
FLAG_IGNORE_CHANGEiEntity
FLAG_IGNORE_ENTITYiEntity
FLAG_OPACIFYiEntity
FLAG_REMOVEDiEntity
PropertiesDeclared byDescription
ArrayPropertiesaEntity
changesaEntity
errorsaEntity
flagsaEntity
keyEmbeddedEntity
linksaEntity
parentEmbeddedEntityThe entity this one is embedded within.
SearchPropertiesaEntity
statusaEntity
MethodsDeclared byDescription
addFlags($flags)aEntity
addLink($link)aEntityAppend a link.
archive()aEntityThis function is called to 'delete' the entity.
ArrayProperties()aEntityBuild (once per class, then cached in the static $ArrayProperties array) the list of every #[ArrayProperty] declared on this class, its parent classes, and the traits they use -- by reflection…
ArrayProperty($name)aEntity
CheckData($data, $errors)aEntityCheck data before it touches any entity: would an entity made from $data be valid?
clearChanges()aEntityReset change tracking: clears iEntity::FLAG_CHANGED and forgets every recorded change.
compareTo($value)aEntityCompare value
conversionError($key, $e)aEntityThe error recorded for a value that could not be set at all (usually: it could not be converted to its property's type), in the same form as a validation error.
Copy($entity, $parent, $key, $properties)EmbeddedEntityBuild a copy of $entity, re-parented under a (possibly different) $parent/$key.
debugName()aEntity
get($path, $default)aEntityRead a (possibly nested) value by json-path, e.g.
getArrayProperty($key, $isRef, $store)aEntityRead a single array property's current value, through its getter (a direct property, a path alias, or a method).
getChanges($asArray, $store)aEntity
getCollection()EmbeddedEntity
getErrors()aEntity
getFlags()aEntity
getId()EmbeddedEntity
getInvalidItems($keys)aEntityThe items of the values set that could not be converted: a list or an object was given, one of its items was not valid (an unknown uid), so the property kept its previous value.
getLabel()aEntity
getLinks()aEntity
getLinksByRel($rels, $all)aEntityGet a list of Reference that have a specific relationship.
getMetadata()aEntity
getParentIndex()EmbeddedEntity
getPath()EmbeddedEntity
getRepository()EmbeddedEntity
getStatus()aEntity
getTitle()aEntity
getView()aEntity
hasChanged($keys)aEntity
hasFlags($flags, $strict)aEntity
hasStatusChanged()aEntity
HiddenPath($path)aEntityThe hidden property (ArrayProperty::isHidden) a json-path goes through, known from the declared types alone: of this class, or of a class a property on the way may hold -- every class of its t…
ignoreChanges($value)aEntityTemporarily suppress markChanged (used e.g.
isActive()aEntity
isArchive()aEntity
isArrayPropertySet($key, $store)aEntity
isChanged()aEntity
isCreated()aEntity
isDraft()aEntity
isEmpty()aEntity
isFinal()aEntity
isHiddenPath($path)aEntity
isOpacified()aEntity
isPending()aEntity
isRemoved()aEntity
isSimilar($value)aEntityCompare entities using unique fields (@unique), to find if they represent the same entity
isUnique()aEntityTells if an entity has enough information to be unique (at least one unique group has no null)
isValid()aEntity
isValidated()aEntity
ListClassReferences($onlyStorable)aEntityGet a list of all the classes and their properties that are using references to this class.
loadArray($data, $coerceOptions, $fromStore)aEntitySet every entry of $data as an array property, through setArrayProperty (so each value is coerced by its property's schema).
loadFromStore($data)aEntityLoad $data as this entity's initial state (e.g.
localName()EmbeddedEntity
markChanged($keys)EmbeddedEntitySame as aEntity::markChanged, also marking the parent's own $key property changed (since that's where this entity is actually stored).
mutate($type, $path, $value, $oldValue)aEntity\MMO\core\interfaces\iMutationObserver::mutate -- besides the normal tArrayProperties::mutate behavior, walks up $path to find the nearest enclosing aEntity (the mutation may have happened dee…
offsetExists($key)aEntity\ArrayAccess::offsetExists -- tells whether $key is a *declared* #[ArrayProperty], not whether it currently holds a non-default value (use isArrayPropertySet for that).
offsetGet($key)aEntity\ArrayAccess::offsetGet
offsetSet($key, $value)aEntity\ArrayAccess::offsetSet
offsetUnset($key)aEntity\ArrayAccess::offsetUnset -- equivalent to setting the property to null (its coerced value depends on the property's schema: e.g.
opacify($value)aEntityHide this entity's properties from toArray output (typically used to redact an entity the current viewer isn't allowed to see the details of, while still letting it be referenced by uid/metadata).
push($path, $value)aEntityAppend a value to a (possibly nested) list property by json-path.
removeFlags($flags)aEntity
removeLink($link)aEntityRemove a link (by identity).
removePermanently()aEntityRemove this entity from the repository once MMO\commit() is called WARNING: This will permanently remove the entity.
Schema()aEntityThe JSON-Schema describing every #[ArrayProperty] of this class (built once and cached by ArrayProperties).
SearchProperty($name)aEntity
set($path, $value)aEntityWrite a (possibly nested) value by json-path, creating intermediate structure as needed.
setArrayProperty($key, $value, $coerceOptions, $ignoreReadonly)aEntitySame as tArrayProperties::setArrayProperty, plus: any coercion/validation failure is caught and recorded in getErrors (making the entity isValid()-false) instead of propagating as an…
setArrayPropertyOffset($key, $offset, $value, $coerceOptions)aEntitySame as tArrayProperties::setArrayPropertyOffset, plus: when pushing (offset === null) a new entity onto a list property, if an existing item is isSimilar to the new value, that item's of…
setLinks($links)aEntityReplace every link with $links.
setParentIndex($index)EmbeddedEntityMove this entity to a different position within $parent[$key] (removing it from its current position first, if any), and mark the parent changed.
setStatus($status)aEntity
store()aEntityExport all array properties with store set to true.
test($filter)aEntity
toArray($fields, $flatten, $recursive)aEntitySame as tArrayProperties::toArray, except an isOpacified entity always exports only its 'uid' and 'metadata' (its other properties are hidden from output).
toLink($attributes)aEntity
traitMutate($type, $path, $value, $oldValue)aEntity\MMO\core\interfaces\iMutationObserver::mutate -- reacts to a mutation that happened deep inside one of this object's array properties (e.g.
traitSetArrayProperty($key, $value, $coerceOptions, $fromStore)aEntitySet array property
traitSetArrayPropertyOffset($key, $offset, $value, $coerceOptions)aEntitySet/push a value into an array property
traitToArray($fields, $flatten, $recursive)aEntityExport fields to an array.
uid()EmbeddedEntity
validate($errors)aEntityValidate this entity: its current values against its own tArrayProperties::Schema, plus every value that could not even be set -- one that could not be converted to its property's type never r…
View()aEntity