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

Mode

MMO\client\classes · 1 symbole · générée le 27 Oct 2026

class

Mode

Mode.php:22

A display mode: a way the application looks for whoever turns it on. It never gives a right -- what a user may do is their scopes' (mmo.oauth) -- it only decides what is shown: pages and menu entries, parts of a page, tools.

final class MMO\client\classes\Mode
Espace de noms
MMO\client\classes
Voir
Modes (modes). A mode with a scope is only offered to whoever holds it (mmo.oauth answers, ModeAccess); one without is offered to everybody.
Two kinds, which combine: - a **level** ([`LEVEL`](https://mmoframework.fr/fr/documentation/mmo.client/php/classes/Mode.md#mode-level)): how dense the application is, one at a time -- `simple`, `standard`, `expert`. A level has a `rank`: what a content asks of a level is shown from that level up. - a **layer** ([`LAYER`](https://mmoframework.fr/fr/documentation/mmo.client/php/classes/Mode.md#mode-layer)): tools and cues drawn over whatever level is shown, any number at once -- `dev` (mmo.admin's developer mode), `writer`, `translator`... Declared by a library or an application through [`ModesList`](https://mmoframework.fr/fr/documentation/mmo.client/php/events/ModesList.md#modeslist), or in the configuration of
new Mode('dev', Mode::LAYER, 'Developer', icon: 'code', scope: 'modes.dev', shortcut: 'ctrl+alt+d')new Mode('expert', Mode::LEVEL, 'Expert', icon: 'gauge-high', rank: 2)

Index

IDwhat an id is made of: it goes in a css attribute selector and in a url, unescaped
LAYERa layer: any number at once, over the level
LEVELa level: one at a time, ordered by rank
description readonly
icon readonly
id readonly
kind readonly
label readonly
rank readonly
scope readonly
shortcut readonly
FromArray($id, $data) static
isLayer()
isLevel()
toArray()
__construct($id, $kind, $label, $icon, $description, $scope, $rank, $shortcut)

Constantes3

ID

what an id is made of: it goes in a css attribute selector and in a url, unescaped

const ID = '/^[a-z][a-z0-9_-]{0,39}$/i'

LAYER

a layer: any number at once, over the level

const LAYER = 'layer'

LEVEL

a level: one at a time, ordered by rank

const LEVEL = 'level'

Propriétés8

description

readonly
readonly ?string $description
Type
null | string

icon

readonly
readonly ?string $icon
Type
null | string

id

readonly
readonly string $id
Type
string

kind

readonly
readonly string $kind
Type
string

label

readonly
readonly string $label
Type
string

rank

readonly
readonly int $rank
Type
int

scope

readonly
readonly ?string $scope
Type
null | string

shortcut

readonly
readonly ?string $shortcut
Type
null | string

Méthodes5

FromArray($id, $data)

staticMode.php:61
static function FromArray(string $id, array $data): self
$idstring
$dataarraywhat the configuration of Modes says of it: {kind, label, icon, description, scope, rank, shortcut}
retourneself
Mode::FromArray('writer', ['kind' => 'layer', 'label' => 'Writer', 'icon' => 'pen', 'scope' => 'modes.writer'])

toArray()

Mode.php:76
function toArray(): array
retournearraywhat the page is given of it (MMO.config.modes.available), its texts translated

__construct($id, $kind, $label, $icon, $description, $scope, $rank, $shortcut)

Mode.php:41
function __construct( string $id, string $kind, string $label, ?string $icon = null, ?string $description = null, ?string $scope = null, int $rank = 0, ?string $shortcut = null )
$idstringwhat pages (index.json's level / modes) and markup (data-level / data-mode) call it
$kindstringLEVEL or LAYER
$labelstringan English key, translated when shown (I18n)
$icon = nullnull | stringan <mmo-icon> name
$description = nullnull | stringan English key: what the mode shows, for whoever chooses it
$scope = nullnull | stringthe scope a user needs to turn it on (mmo.oauth), null for everybody
$rank = 0inta level's place, the lowest first; a layer's order in the switcher
$shortcut = nullnull | stringa keyboard shortcut toggling a layer (ctrl+alt+d)