globals.php
Registers linked global source records, validates instance properties, resolves nested content within limits, and preserves fallback copies when a source is unavailable.
Responsibility#
Registers linked global source records, validates instance properties, resolves nested content within limits, and preserves fallback copies when a source is unavailable.
This is an implementation reference for the released 0.9.13 module. Internal PHP helpers are not a compatibility promise for third-party callers. Prefer the documented REST, Abilities, theme, and filter contracts.
Related modules#
editor, linked-components, templates.
Module constants#
const CANTATA_EDIT_GLOBAL = 'kindly_global';
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.
WordPress hooks#
| Operation | Hook |
|---|---|
add_action |
init |
apply_filters |
cantata_edit_globals_cap |
add_action |
rest_api_init |
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_can_globals#
function cantata_edit_can_globals(): bool
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_dev.
Source location: includes/globals.php:27.
cantata_edit_global_props#
function cantata_edit_global_props( string $html ): array
A source's exposed properties: [ key => words ] from its data-ke-prop elements.
Implementation connections: cantata_edit_linked_parse.
Source location: includes/globals.php:32.
cantata_edit_global_html#
function cantata_edit_global_html( int $id, array $props = [], bool $draft = false ): ?string
What visitors see for an instance: the published source with the instance's own property words, or null.
Implementation connections: cantata_edit_linked_inner, cantata_edit_linked_parse.
Source location: includes/globals.php:45.
cantata_edit_globals_render#
function cantata_edit_globals_render( string $html, int $depth = 0, array $seen = [] ): string
Each instance shows its source's published version (nested instances too, three deep, never itself).
Implementation connections: cantata_edit_global_html, cantata_edit_linked_inner, cantata_edit_linked_parse.
Source location: includes/globals.php:64.
cantata_edit_global_usage#
function cantata_edit_global_usage( int $id ): array
Where a source is used: [ count, where: [ titles ] ] over pages, posts, parts, templates, drafts and other globals.
Source location: includes/globals.php:87.
cantata_edit_global_out#
function cantata_edit_global_out( WP_Post $p, bool $full ): array
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_props, cantata_edit_global_usage, cantata_edit_template_clean.
Source location: includes/globals.php:96.