Guide
Corex\Guides\Guide · class · Add-ons layer
One guide, contributed by Corex or by any site built on it (spec 084, FR-006 / FR-008). Built through a fluent chain rather than a seven-argument constructor, because the audience is a site developer writing this in their own plugin and every optional field is genuinely optional: Guide::for(‘perego-projects’, __(‘Managing projects’, ‘perego’)) ->inSection(‘content’) ->onScreen(‘edit.php?post_type=perego_project’) ->requiring(‘edit_posts’) ->withTopic($topic); Immutable: every method returns a new instance, so a guide can be built from a shared base without one caller’s ->requiring() leaking into another’s.
Public API
Section titled “Public API”for(string $id, string $title): self
Section titled “for(string $id, string $title): self”withSummary(string $summary): self
Section titled “withSummary(string $summary): self”inSection(string $section): self
Section titled “inSection(string $section): self”onScreen(string $screen): self
Section titled “onScreen(string $screen): self”The admin address this guide describes, e.g. edit.php?post_type=corex_job. Rendered on the Guides screen as a link straight to that screen, so a reader who has just finished the steps is one click from doing them. A guide that describes no single screen simply omits it and carries no link. It also fed the screen’s WordPress contextual help tab until spec 097 removed that surface from CoreX admin; the address itself was always the better half of that feature and stays.
requiring(string $capability): self
Section titled “requiring(string $capability): self”The capability a reader needs before this guide is worth showing them (FR-009). Empty means “anyone who can see the admin”. Naming a capability the reader lacks would describe a screen they cannot open, which teaches them the product is broken.
ordered(int $order): self
Section titled “ordered(int $order): self”withTopic(GuideTopic $topic): self
Section titled “withTopic(GuideTopic $topic): self”isAvailableTo(): bool
Section titled “isAvailableTo(): bool”Whether this guide is worth showing the current user. Only the capability is checked here. Whether the contributing add-on is active is not a question this class can answer, and deliberately is not asked: an add-on registers its guides from its own service provider, so an inactive add-on never registers and there is nothing to filter out. A list of add-on slugs kept here would be a second source of truth about which add-ons exist, and it would be wrong the first time one was renamed.
searchText(): string
Section titled “searchText(): string”Everything a reader could search this guide by.