Kindly EditDocumentationTry the editor

tones.php

Resolves theme tone and color choices, validates their token roles, and emits the corresponding presentation rules.

Responsibility#

Resolves theme tone and color choices, validates their token roles, and emits the corresponding presentation rules.

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.

blocks, theme.

WordPress hooks#

Operation Hook
add_filter cantata_edit_config
add_action wp_enqueue_scripts
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_token_roles#

function cantata_edit_token_roles(): array

Theme contract v1: every role a theme can set, and what it is for.

Source location: includes/tones.php:22.

cantata_edit_theme_tokens#

function cantata_edit_theme_tokens(): array

The theme's token values from cantata-edit.json, limited to known roles and to values that are plainly CSS values.

Implementation connections: cantata_edit_config, cantata_edit_token_roles.

Source location: includes/tones.php:46.

cantata_edit_tones#

function cantata_edit_tones( ?array $config = null ): array

The tones editors can choose: [ class => label ], "" being the section's own background.

Implementation connections: cantata_edit_config.

Source location: includes/tones.php:59.

cantata_edit_tone_styles#

function cantata_edit_tone_styles( array $config ): array

The closed lists tones, layouts and photo styles add to the inspector (the same mechanism as the theme's "styles").

Implementation connections: cantata_edit_tones.

Source location: includes/tones.php:77.

cantata_edit_component_styles#

function cantata_edit_component_styles( array $config ): array

The Layout and Tone lists a theme's components declare in their headers ("Layouts:", "Tones:"), each matched to the component's own section class. Components without those lines get nothing extra.

Implementation connections: cantata_edit_components, cantata_edit_tone_styles, cantata_edit_tones.

Source location: includes/tones.php:100.

cantata_edit_token_css#

function cantata_edit_token_css(): string

The theme's JSON tokens as :root variables, plus the tone button rules.

Implementation connections: cantata_edit_asset_ver, cantata_edit_preview_inline, cantata_edit_theme_tokens, cantata_edit_tone_button_css.

Source location: includes/tones.php:136.

cantata_edit_tone_button_css#

function cantata_edit_tone_button_css(): string

The theme's buttons on dark and accent tones. Its button classes are known (cantata-edit.json "button" and "button2"), so the second button turns into an outline in the tone's text color. On the dark tone the main button takes accent-on-dark with dark text, and on the accent tone it inverts. A theme that styles these itself only needs a more specific rule.

Implementation connections: cantata_edit_blocks, cantata_edit_components, cantata_edit_config, cantata_edit_theme_tokens, cantata_edit_token_roles, cantata_edit_tones.

Source location: includes/tones.php:160.

cantata_edit_brand#

function cantata_edit_brand( array $config ): string

The site's short name for editor labels: the theme's "brand" (cantata-edit.json), else the site title without a trailing "(local)", "(staging)" or " | tagline", so a dev copy doesn't label its sections "Example site (local) sections".

Source location: includes/tones.php:210.

About this page

Documents Kindly Edit 0.9.16. Source: includes/tones.php. Theme choices and account permissions can change which controls appear.

Type a word or phrase to search the full documentation.