theme.php
Loads the active theme’s configuration, components, design tokens, and editable-root contract, with parent/child theme resolution.
Responsibility#
Loads the active theme’s configuration, components, design tokens, and editable-root contract, with parent/child theme resolution.
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.
WordPress hooks#
| Operation | Hook |
|---|---|
apply_filters |
cantata_edit_token_values |
apply_filters |
cantata_edit_config |
apply_filters |
cantata_edit_component_files |
add_action |
admin_notices |
apply_filters |
cantata_edit_component_metadata |
apply_filters |
cantata_edit_components |
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_theme_file#
function cantata_edit_theme_file( string $relative ): ?string
First existing path among the child theme and the parent theme.
Source location: includes/theme.php:17.
cantata_edit_asset_ver#
function cantata_edit_asset_ver( string $relative ): string
A cache-busting version for one of the plugin's asset files, without ever warning if the file is missing.
Source location: includes/theme.php:28.
cantata_edit_tokens#
function cantata_edit_tokens( string $html, ?string $theme_uri = null ): 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/theme.php:33.
cantata_edit_theme_uri_for_file#
function cantata_edit_theme_uri_for_file( string $file ): string
The parent or child URL that owns a theme file.
Source location: includes/theme.php:48.
cantata_edit_config#
function cantata_edit_config(): array
The theme's cantata-edit.json, with defaults for anything it leaves out.
Implementation connections: cantata_edit_theme_file.
Source location: includes/theme.php:55.
cantata_edit_parse_layouts#
function cantata_edit_parse_layouts( string $line ): array
A component header's "Layouts:" line: [ class => label ]. The first entry is the default and adds no class;
the rest add layout-
Source location: includes/theme.php:97.
cantata_edit_parse_keywords#
function cantata_edit_parse_keywords( string $line ): array
A "Keywords:" header line: extra words people might search for ("faq, questions"), lowercased.
Source location: includes/theme.php:111.
cantata_edit_parse_tones#
function cantata_edit_parse_tones( string $line ): ?array
A component header's "Tones:" line: the tone names it suits, or null for all of them (the default).
Source location: includes/theme.php:116.
cantata_edit_component_files#
function cantata_edit_component_files(): array
Ordered parent/child component files; an identical child basename intentionally overrides its parent.
Source location: includes/theme.php:128.
cantata_edit_component_collisions#
function cantata_edit_component_collisions(): array
Distinct numbered filenames must not silently compete for one persistent component slug.
Implementation connections: cantata_edit_component_files.
Source location: includes/theme.php:146.
cantata_edit_components#
function cantata_edit_components(): array
The component library: [ slug => [ name, kind, category, description, class, layouts, tones, html ] ], in
file-name order, so a theme orders its picker by numbering its files (10-hero.html, 20-media.html ...).
"class" is the first class on the component's
Implementation connections: cantata_edit_component_files, cantata_edit_parse_keywords, cantata_edit_parse_layouts, cantata_edit_parse_tones, cantata_edit_theme_uri_for_file, cantata_edit_tokens.
Source location: includes/theme.php:172.
cantata_edit_part_default#
function cantata_edit_part_default( string $slug ): string
The theme's default copy of a part (header, footer ...), or '' if it has none.
Implementation connections: cantata_edit_theme_file, cantata_edit_theme_uri_for_file, cantata_edit_tokens.
Source location: includes/theme.php:231.
cantata_edit_preview_handles#
function cantata_edit_preview_handles(): array
Dependency-first preview styles, without changing WordPress's global print queue.
Source location: includes/theme.php:237.
cantata_edit_preview_inline#
function cantata_edit_preview_inline(): string
Inline CSS the theme and plugins attached to their stylesheets (design tokens, generated button rules): previews need it too.
Implementation connections: cantata_edit_preview_handles.
Source location: includes/theme.php:255.
cantata_edit_preview_styles#
function cantata_edit_preview_styles(): array
The stylesheets a component preview needs: whatever the theme enqueued for the front end.
Implementation connections: cantata_edit_preview_handles.
Source location: includes/theme.php:271.