kindly-menu.php
Organizes the WordPress administration navigation and management screens for Kindly-owned content and settings.
Responsibility#
Organizes the WordPress administration navigation and management screens for Kindly-owned content and settings.
This is an implementation reference for the released 0.9.21 module. Internal PHP helpers are not a compatibility promise for third-party callers. Prefer the documented REST, Abilities, theme, and filter contracts.
Related modules#
branding, globals, parts, popups, rest, templates, theme-templates, theme.
Module constants#
const CANTATA_EDIT_MENU = 'kindly';
These values describe this release. Defined configuration constants and generated identifiers can have different ownership; do not edit stored values directly without following the corresponding workflow.
Literal option and cache keys#
date_format. These are direct literal keys found in this module; dynamically constructed keys and metadata constants are covered by the storage reference.
WordPress hooks#
| Operation | Hook |
|---|---|
add_action |
admin_menu |
do_action |
cantata_edit_menu_after_templates |
add_action |
admin_page_access_denied |
add_action |
admin_post_kindly_menu |
apply_filters |
cantata_edit_menu_action |
add_action |
admin_enqueue_scripts |
add_action |
cantata_edit_menu_fonts_refresh |
add_action and add_filter subscribe to a hook; do_action and apply_filters expose a hook. A subscription is not itself a new extension API. Dynamic hook names are not included in this literal inventory.
Function and method reference#
cantata_edit_menu_url#
function cantata_edit_menu_url( string $page = CANTATA_EDIT_MENU, array $args = [] ): string
A Kindly screen's address.
Source location: includes/kindly-menu.php:23.
cantata_edit_menu_parent#
function cantata_edit_menu_parent(): string
The menu's own address: Templates for the people who manage the site's look, otherwise Saved, so the menu never opens a screen the person may not see. Every Kindly screen is added under this.
Implementation connections: cantata_edit_menu_url, cantata_edit_product_name.
Source location: includes/kindly-menu.php:31.
cantata_edit_menu_list_for#
function cantata_edit_menu_list_for( string $type ): string
The Kindly list a popup, theme template or loop template belongs to, for whoever may see it; '' for anything else.
Implementation connections: cantata_edit_menu_url.
Source location: includes/kindly-menu.php:59.
cantata_edit_menu_rest#
function cantata_edit_menu_rest( string $method, string $route, array $params = [] ): array
One REST call as the current person: [ data, error message or '' ].
Source location: includes/kindly-menu.php:70.
cantata_edit_menu_notice#
function cantata_edit_menu_notice( ?string $text = null ): string
A message for the next screen this person opens.
Implementation connections: cantata_edit_menu_rest, cantata_edit_menu_trash_types, cantata_edit_menu_url, cantata_edit_popup_kinds, cantata_edit_theme_default_where, cantata_edit_theme_where, cantata_edit_without_kses.
Source location: includes/kindly-menu.php:84.
cantata_edit_menu_trash_types#
function cantata_edit_menu_trash_types(): array
The kinds of post these screens list, and so may restore from the Trash.
Source location: includes/kindly-menu.php:175.
cantata_edit_menu_form#
function cantata_edit_menu_form( string $do, string $back, string $inner, array $hidden = [], string $class = '' ): string
A form that posts one action: hidden fields, then $inner (fields and the button).
Source location: includes/kindly-menu.php:182.
cantata_edit_menu_trash#
function cantata_edit_menu_trash( string $do, int $id, string $back, string $title ): string
A Trash button for one item; it asks first (assets/kindly-admin.js), since these have no Trash screen of their own.
Implementation connections: cantata_edit_menu_icon.
Source location: includes/kindly-menu.php:193.
cantata_edit_menu_button#
function cantata_edit_menu_button( string $do, int $id, string $back, string $label, string $aria ): string
A small action button for one item (Duplicate, Turn on).
Implementation connections: cantata_edit_menu_form.
Source location: includes/kindly-menu.php:198.
cantata_edit_menu_head#
function cantata_edit_menu_head( string $title, string $intro = '', string $add = '' ): void
The screen's title (with what sits beside it: since 0.9.21 its video button, training, or the Training screen's guide link), its notice and its styles.
Implementation connections: cantata_edit_asset_ver, cantata_edit_menu_notice, cantata_edit_menu_site_fonts, cantata_edit_menu_site_look.
Source location: includes/kindly-menu.php:203.
cantata_edit_menu_site_look#
function cantata_edit_menu_site_look(): string
These administration screens follow the site's own look: the theme's colors, corner and fonts from cantata-edit.json's tokens, as the variables kindly-admin.css draws with. Each value is checked; one that isn't a plain color, length or font list is left out, and a theme with no tokens keeps the neutral look.
Implementation connections: cantata_edit_config.
Source location: includes/kindly-menu.php:235.
cantata_edit_menu_web_families#
function cantata_edit_menu_web_families(): array
The tokens' display and body font families that a browser would have to download (not Arial, Georgia, system-ui…).
Implementation connections: cantata_edit_config.
Source location: includes/kindly-menu.php:283.
cantata_edit_menu_fonts_key#
function cantata_edit_menu_fonts_key(): string
Where the site's fonts are remembered: per theme (child and parent, with their versions) and per token fonts.
Implementation connections: cantata_edit_menu_web_families.
Source location: includes/kindly-menu.php:297.
cantata_edit_menu_site_fonts#
function cantata_edit_menu_site_fonts(): array
The web-font stylesheets the site's own pages load for the tokens' fonts (Google Fonts, Bunny, Adobe), so these screens can use the site's type. They're read from the home page as a visitor gets it, by a one-off background job (never inside an admin request: no theme or plugin code runs here), and remembered for a week. Until then, or when the tokens name only fonts every computer has, the screens use the font lists as they are.
Implementation connections: cantata_edit_menu_fonts_key, cantata_edit_menu_web_families.
Source location: includes/kindly-menu.php:308.
cantata_edit_menu_fonts_refresh#
function cantata_edit_menu_fonts_refresh(): array
The background job: the home page's font stylesheets for the tokens' families, remembered (an hour after a failure).
Implementation connections: cantata_edit_menu_fonts_key, cantata_edit_menu_web_families.
Source location: includes/kindly-menu.php:317.
cantata_edit_menu_table#
function cantata_edit_menu_table( array $cols, array $rows, string $empty ): void
A plain list for Saved: column names, then rows of cell HTML (escaped); $empty when there are none.
Implementation connections: cantata_edit_menu_list.
Source location: includes/kindly-menu.php:344.
cantata_edit_menu_state#
function cantata_edit_menu_state( string $status, bool $pending ): string
Published, Draft, and whether there are unpublished changes, in words.
Source location: includes/kindly-menu.php:362.
cantata_edit_menu_dot#
function cantata_edit_menu_dot( string $tone, string $words, string $more = '' ): string
A card's state line: a dot and its words ('live', 'draft' or 'off').
Source location: includes/kindly-menu.php:368.
cantata_edit_menu_card_state#
function cantata_edit_menu_card_state( string $status, bool $pending ): string
A published item's state for a card: live, live with changes waiting, or a draft.
Implementation connections: cantata_edit_menu_dot.
Source location: includes/kindly-menu.php:373.
cantata_edit_menu_where#
function cantata_edit_menu_where( array $w, string $none = '' ): string
Where a theme template or popup applies, in words (the editor's own wording, assets/theme-settings.js).
Source location: includes/kindly-menu.php:381.
cantata_edit_menu_when#
function cantata_edit_menu_when( array $when ): string
What opens a popup by itself, in words; '' when only a link or button does.
Source location: includes/kindly-menu.php:421.
cantata_edit_menu_icon#
function cantata_edit_menu_icon( string $do, int $id, string $back, string $icon, string $label, string $aria, string $class = '', string $confirm = '' ): string
An icon button for one item (Duplicate, Restore), named for screen readers and on hover.
Implementation connections: cantata_edit_menu_form.
Source location: includes/kindly-menu.php:444.
cantata_edit_menu_switch#
function cantata_edit_menu_switch( int $id, string $title, bool $on ): string
A popup's on/off switch: it publishes it again or takes it off every page, then comes back here.
Implementation connections: cantata_edit_menu_form.
Source location: includes/kindly-menu.php:449.
cantata_edit_menu_section#
function cantata_edit_menu_section( string $title, string $body, string $actions = '', string $count = '', string $class = '', string $lead = '' ): string
A section: a header row (its title and count, or $lead such as a list's search, on the left; $actions on the right), then $body. HTML arguments are built escaped.
Source location: includes/kindly-menu.php:466.
cantata_edit_menu_list#
function cantata_edit_menu_list( array $cols, array $rows ): string
A table of items. $cols is [ key => column name ] ('' for the actions column); each row is [ 'cells' => [ key => HTML ], 'attrs' => [ data-* => value ] ]. The first column is the row's header. On phones each row stacks, with its column names beside the values (data-label).
Source location: includes/kindly-menu.php:480.
cantata_edit_menu_lower#
function cantata_edit_menu_lower( string $s ): string
Lower case as a browser's toLowerCase() makes it (accented letters too), for a list's search text.
Source location: includes/kindly-menu.php:505.
cantata_edit_menu_name#
function cantata_edit_menu_name( string $art, string $title, string $url, string $sub = '' ): string
A row's name cell: a small drawing and the name, both opening the editor, with what kind it is beneath.
Source location: includes/kindly-menu.php:510.
cantata_edit_menu_row_tools#
function cantata_edit_menu_row_tools( string $title, string $url, array $tools = [] ): string
A row's actions: Edit, then its icon buttons (built escaped).
Source location: includes/kindly-menu.php:517.
cantata_edit_menu_toolbar#
function cantata_edit_menu_toolbar( string $search_label, array $filters = [] ): string
Search and filters for a list, in its section: a search box, then each filter as a select ([ name => [ label,
[ value => option ], its no-filter choice such as Any status ] ]), then Clear while any is set. Rows carry data-search and a data-
Source location: includes/kindly-menu.php:527.
cantata_edit_menu_foot#
function cantata_edit_menu_foot( string $all ): string
A filtered list's foot: how many show of how many, and the line that says nothing matches (with Clear).
Source location: includes/kindly-menu.php:539.
cantata_edit_menu_empty#
function cantata_edit_menu_empty( string $art, string $text, string $add = '' ): string
Nothing here yet: a drawing of what would be, a sentence, and the button that makes one.
Source location: includes/kindly-menu.php:546.
cantata_edit_menu_add#
function cantata_edit_menu_add( string $do, string $back, string $button, array $kinds, string $placeholder, string $make, string $title = '', bool $shown = true ): string
Add: a button, and the focused window it opens over the screen (a native dialog; Esc, Close and Cancel leave it, and focus goes back to the button). Its header has Close and the title on the left, Cancel and $make on the right; beneath, the name, then the kinds drawn as pictures. $kinds is [ value => [ label, art ] ]. While its list is empty ($shown false) the button stays out of sight: the empty list's own button opens the same window, so there is one Add.
Implementation connections: cantata_edit_menu_form.
Source location: includes/kindly-menu.php:557.
cantata_edit_menu_trashed#
function cantata_edit_menu_trashed( array $types, string $back ): void
What's in the Trash of these kinds, as a closed section at the end, each with Restore; nothing when it's empty.
Implementation connections: cantata_edit_menu_button, cantata_edit_menu_list.
Source location: includes/kindly-menu.php:578.
cantata_edit_menu_art#
function cantata_edit_menu_art( string $kind, array $layout = [] ): string
A small drawing of what a template or popup is: the page in grays and its own part in the accent color. Popups are drawn from their real layout (where the box sits, how wide, whether the page is dimmed), so each card shows its own.
Source location: includes/kindly-menu.php:600.
cantata_edit_menu_templates#
function cantata_edit_menu_templates(): void
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Implementation connections: cantata_edit_can_themes, cantata_edit_menu_add, cantata_edit_menu_art, cantata_edit_menu_card_state, cantata_edit_menu_dot, cantata_edit_menu_empty, cantata_edit_menu_foot, cantata_edit_menu_head, cantata_edit_menu_icon, cantata_edit_menu_list, cantata_edit_menu_lower, cantata_edit_menu_name, cantata_edit_menu_rest, cantata_edit_menu_row_tools, cantata_edit_menu_section, cantata_edit_menu_toolbar, cantata_edit_menu_trash, cantata_edit_menu_trashed, cantata_edit_menu_where, cantata_edit_part_draft, cantata_edit_part_edit_url, cantata_edit_part_other_drafts, cantata_edit_part_post, cantata_edit_theme_kinds, cantata_edit_training_button.
Source location: includes/kindly-menu.php:661.
cantata_edit_menu_popups#
function cantata_edit_menu_popups(): void
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Implementation connections: cantata_edit_can_popups, cantata_edit_menu_add, cantata_edit_menu_art, cantata_edit_menu_dot, cantata_edit_menu_empty, cantata_edit_menu_foot, cantata_edit_menu_head, cantata_edit_menu_icon, cantata_edit_menu_list, cantata_edit_menu_lower, cantata_edit_menu_name, cantata_edit_menu_rest, cantata_edit_menu_row_tools, cantata_edit_menu_section, cantata_edit_menu_switch, cantata_edit_menu_toolbar, cantata_edit_menu_trash, cantata_edit_menu_trashed, cantata_edit_menu_when, cantata_edit_menu_where, cantata_edit_popup_defaults, cantata_edit_popup_kinds, cantata_edit_popup_settings, cantata_edit_training_button.
Source location: includes/kindly-menu.php:734.
cantata_edit_menu_saved#
function cantata_edit_menu_saved(): void
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Implementation connections: cantata_edit_can_globals, cantata_edit_global_usage, cantata_edit_menu_card_state, cantata_edit_menu_head, cantata_edit_menu_rest, cantata_edit_menu_section, cantata_edit_menu_table, cantata_edit_menu_trash, cantata_edit_template_access, cantata_edit_template_row, cantata_edit_training_button.
Source location: includes/kindly-menu.php:796.