Skip to content
docsv0.34.0

SectionCatalogue

Every section the booted plugins declared, validated and ordered. Built per request from the plugin instances the kernel holds, so a plugin that boots after the panel still shows up. Duplicate ids fail loudly ({@see SectionConflictException}); the panel never picks one silently.

SectionCatalogue::discover()

public static function discover(iterable $plugins): self

Collects the sections of every plugin that implements {@see AdminSectionProvider}.

Parameters

Parameters of discover()
NameTypeDescription
$pluginsiterable<object>the booted plugin instances, in any order

SectionCatalogue::sections()

public function sections(): array

The sections in sidebar order.

SectionCatalogue::roots()

public function roots(): array

The sections the MAIN NAVIGATION shows: the ones that belong under nobody. 🚨 THIS IS A SECOND READER AND NOT A NARROWING OF {@see sections()}, deliberately. Three of that method's five callers want every section: the panel's 404 lists the ids present, and a child missing from the error whose whole job is naming what exists would be invisible exactly when somebody is looking for it; the component book must cover a child's component like any other; and the TUI needs state for every section it can open. Narrowing the old method would have broken all three in silence (greenhouse decisions/0268). A section whose parent nobody declared comes back HERE, as a root. The alternative hides a working section because a different plugin is absent, which turns uninstalling one thing into losing another.

SectionCatalogue::children()

public function children(string $id): array

The sections declared under that one, in the same order the sidebar uses. Empty for a section nobody named as a parent — which is what the shell reads to decide whether to paint a gear at all.

Parameters

Parameters of children()
NameTypeDescription
$idstring

SectionCatalogue::find()

public function find(string $id): ?Milpa\Admin\Section\AdminSection

The section with that id, or null when no plugin declared it.

Parameters

Parameters of find()
NameTypeDescription
$idstring

SectionCatalogue::first()

public function first(): ?Milpa\Admin\Section\AdminSection

The section the panel opens on — the first ROOT in sidebar order — or null when there is none. A child can never be the front page: it is reached through its parent's gear, and a panel that opened on somebody's settings screen would answer «what is this house» with «here are its knobs» (greenhouse decisions/0264, decisions/0268).

SectionCatalogue::declaredBy()

public function declaredBy(string $id): ?string

The plugin class that declared a section, or null when no plugin declared it.

Parameters

Parameters of declaredBy()
NameTypeDescription
$idstring

SectionCatalogue::isEmpty()

public function isEmpty(): bool

True when no plugin declared any section.