render.php
Owns the public rendering path for Kindly-built HTML and integrates dynamic sources, responsive styles, native interactions, and approved code output.
Responsibility#
Owns the public rendering path for Kindly-built HTML and integrates dynamic sources, responsive styles, native interactions, and approved code output.
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#
blocks, conditions, dynamic, element-css, element-js, element-php, globals, linked-components, loop-templates, responsive, rest.
Module constants#
const CANTATA_EDIT_META = '_cantata_edit';
const CANTATA_EDIT_DRAFT = '_cantata_edit_draft';
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_filter |
the_content |
apply_filters |
cantata_edit_page_render_source |
add_filter |
the_content |
add_filter |
use_block_editor_for_post |
add_action |
transition_post_status |
add_action |
wp_restore_post_revision |
add_action |
wp_head |
add_action |
wp_footer |
add_action |
post_updated |
add_filter |
get_the_excerpt |
apply_filters |
excerpt_length |
apply_filters |
excerpt_more |
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_is_built#
function cantata_edit_is_built( $post = null ): 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.
Source location: includes/render.php:19.
cantata_edit_is_editing#
function cantata_edit_is_editing(): 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.
Source location: includes/render.php:27.
cantata_edit_page_source#
function cantata_edit_page_source( WP_Post $post ): string
The HTML this viewer should see: the draft while editing or previewing, otherwise what is published.
Implementation connections: cantata_edit_is_editing, cantata_edit_viewed_revision.
Source location: includes/render.php:32.
cantata_edit_render#
function cantata_edit_render( string $html, ?string $owner = null, ?callable $style_sink = null ): string
Fill live slots.
gets [vaisef_events limit="3"], but only for a registered live source (cantata_edit_live_normalize). Visitors get the output without the marker attribute.Implementation connections: cantata_edit_conditions_render, cantata_edit_dyn_render, cantata_edit_element_js_owner_for_post, cantata_edit_element_js_render, cantata_edit_element_php_render, cantata_edit_fill_crumbs, cantata_edit_fill_live_slots, cantata_edit_globals_render, cantata_edit_linked_render, cantata_edit_loop_tpls_render, cantata_edit_render_element_css, cantata_edit_render_responsive.
Source location: includes/render.php:50.
cantata_edit_fill_live_slots#
function cantata_edit_fill_live_slots( string $html ): string
Only actual parsed source elements may nominate a registered live provider. Payload HTML is inserted last.
Implementation connections: cantata_edit_is_editing, cantata_edit_live_normalize.
Source location: includes/render.php:69.
cantata_edit_compile_scoped_styles#
function cantata_edit_compile_scoped_styles( string $html ): array
Pure scoped-style compilation for trusted native presentation sources. Does not run slots, JS or PHP. Entries follow the legacy prefix stylesheet order; only an explicit true sink response suppresses a prefix. Native applications must preload only sources the current visitor may receive and keep unknown styles intact.
Implementation connections: cantata_edit_render_element_css, cantata_edit_render_responsive.
Source location: includes/render.php:113.
cantata_edit_fill_crumbs#
function cantata_edit_fill_crumbs( string $html ): string
Breadcrumbs that follow the page: the theme's crumb element is stored empty with a marker,
, and filled here on every view with flat children: links to Home and the page's parents, then for the page itself. Separators are the theme's CSS (::before), so the markup stays plain. Moving a page under Pages moves its crumb. Visitors get it without the marker; whatever was inside is replaced.Implementation connections: cantata_edit_crumbs_html, cantata_edit_is_editing.
Source location: includes/render.php:134.
cantata_edit_crumbs_html#
function cantata_edit_crumbs_html( WP_Post $post ): string
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_is_editing.
Source location: includes/render.php:163.
cantata_edit_clean_live_slots#
function cantata_edit_clean_live_slots( string $html ): string
On save: a live slot keeps its marker only for a registered source (with its options cleaned); others lose it.
Implementation connections: cantata_edit_live_normalize.
Source location: includes/render.php:175.
cantata_edit_root_attrs#
function cantata_edit_root_attrs( string $root = 'content' ): string
Attributes for the element that holds the page's content. A theme that supports cantata-edit prints
them on its
Implementation connections: cantata_edit_element_js_owner_for_post, cantata_edit_is_built, cantata_edit_is_editing, cantata_edit_missing_alts, cantata_edit_page_source, cantata_edit_public_forms, cantata_edit_public_links, cantata_edit_render.
Source location: includes/render.php:186.
cantata_edit_has_draft#
function cantata_edit_has_draft( int $id ): bool
True when a page has unpublished editor changes (words or title).
Implementation connections: cantata_edit_same_html.
Source location: includes/render.php:308.
cantata_edit_viewed_revision#
function cantata_edit_viewed_revision( WP_Post $post ): ?WP_Post
?cantata_edit_rev=
Source location: includes/render.php:322.
cantata_edit_public_links#
function cantata_edit_public_links( string $html ): string
Links as visitors get them. A page linked while it was a draft is stored by id (?page_id=12, as it had no address yet): once it's published, visitors get its real address. A link that opens a new tab says so to screen readers.
Source location: includes/render.php:369.
cantata_edit_missing_alts#
function cantata_edit_missing_alts( string $html ): string
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Source location: includes/render.php:435.
cantata_edit_public_forms#
function cantata_edit_public_forms( string $html ): string
Baseline form semantics for live shortcodes supplied by a theme or integration. An explicit label always wins. Unlabeled controls get a plain accessible name from their placeholder/name, and a one-field email sign-up cannot submit an empty value merely because the provider forgot the HTML required attribute. An email field in a larger form keeps the form's own choice: many forms ask for a second or optional address (0.9.18 and later; earlier releases made every email field required).
Implementation connections: cantata_edit_conditions_strip, cantata_edit_is_built, cantata_edit_plain_text.
Source location: includes/render.php:451.
cantata_edit_plain_text#
function cantata_edit_plain_text( string $html ): string
The words of stored page HTML, in reading order, with a space wherever one element ends and the next begins.
Source location: includes/render.php:509.