Kindly EditDocumentationTry the editor

responsive.php

Validates screen definitions and per-element responsive declarations, emits state and breakpoint CSS, and handles visibility ranges.

Responsibility#

Validates screen definitions and per-element responsive declarations, emits state and breakpoint CSS, and handles visibility ranges.

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.

editor, sanitize, scoped-style-capture.

Literal option and cache keys#

cantata_edit_screens. 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 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_visual_properties#

function cantata_edit_visual_properties(): array

Keep this list in step with the developer inspector. Values still pass WordPress's CSS filter.

Source location: includes/responsive.php:6.

cantata_edit_screen_spec#

function cantata_edit_screen_spec(): array

Screen sizes (Elementor's breakpoints). Desktop is the base: its Normal style is the element's own inline style. Every other size keeps its own declarations in data-ke-(-hover|-focus) and applies up to its width (Wide screens from its width). Tablets and Phones are always on; the others are the site's choice in Developer mode (Page options > Screen sizes). A size that is switched off keeps what was set on it, which applies again when it is switched back on. A size inherits from the next larger size that is on, then Desktop; Wide screens from Desktop.

Source location: includes/responsive.php:33.

cantata_edit_screen_settings#

function cantata_edit_screen_settings(): array

The stored choice ([ size => [ on, width ] ]) checked against the spec; anything invalid falls back to the defaults.

Implementation connections: cantata_edit_screen_spec, cantata_edit_screens_validate.

Source location: includes/responsive.php:45.

cantata_edit_screens_validate#

function cantata_edit_screens_validate( array $input )

A screen-size choice made valid or refused: whole pixels, Phones at least 320, each size that is on narrower than the larger ones that are on, and Wide screens wider than every other size. Returns the clean settings or WP_Error.

Implementation connections: cantata_edit_screen_spec.

Source location: includes/responsive.php:62.

cantata_edit_screens#

function cantata_edit_screens(): array

The sizes that are on, largest first: [ [ key, label, kind (min|max), width ] ]. Desktop is not listed.

Implementation connections: cantata_edit_screen_settings, cantata_edit_screen_spec.

Source location: includes/responsive.php:98.

cantata_edit_screen_media#

function cantata_edit_screen_media( array $screen ): string

The media query a screen size's rules go in.

Source location: includes/responsive.php:110.

cantata_edit_screen_ranges#

function cantata_edit_screen_ranges(): array

Each size's range of window widths, for Hide on: [ key => [ from, to ] ] (to null: no upper end), Desktop included. The ranges do not overlap, so an element hidden on one size shows on the others.

Implementation connections: cantata_edit_screens.

Source location: includes/responsive.php:118.

cantata_edit_screen_visibility_css#

function cantata_edit_screen_visibility_css(): string

Hide on (Developer > Advanced > Responsive visibility): cb-hide- hides an element on that size's window widths for visitors and in Preview; while editing it stays visible. Made from the sizes that are on, so it follows them.

Implementation connections: cantata_edit_screen_ranges.

Source location: includes/responsive.php:137.

cantata_edit_visual_attributes#

function cantata_edit_visual_attributes(): array

Attributes and selectors for normal, hover and keyboard/mouse focus styles on every screen size.

Implementation connections: cantata_edit_screen_spec.

Source location: includes/responsive.php:150.

cantata_edit_responsive_declarations#

function cantata_edit_responsive_declarations( string $value ): string

No raw stylesheet is stored: only validated declarations from the visual property list.

Implementation connections: cantata_edit_normalize_colours, cantata_edit_visual_properties.

Source location: includes/responsive.php:164.

cantata_edit_clean_responsive#

function cantata_edit_clean_responsive( string $html ): string

Validate attributes again on save, independently of the browser's controls.

Implementation connections: cantata_edit_responsive_declarations, cantata_edit_visual_attributes.

Source location: includes/responsive.php:187.

cantata_edit_css_attribute_value#

function cantata_edit_css_attribute_value( string $value ): string

A quoted CSS attribute selector must never be able to close the generated style element.

Source location: includes/responsive.php:211.

cantata_edit_render_responsive#

function cantata_edit_render_responsive( string $html, ?callable $style_sink = null ): string

Public output uses the same cascade as the editor: Desktop, then each size that is on, largest first.

Implementation connections: cantata_edit_can_dev, cantata_edit_css_attribute_value, cantata_edit_responsive_declarations, cantata_edit_scoped_style_capture_prefix, cantata_edit_screen_media, cantata_edit_screen_settings, cantata_edit_screen_spec, cantata_edit_screen_visibility_css, cantata_edit_screens, cantata_edit_screens_validate, cantata_edit_visual_attributes.

Source location: includes/responsive.php:216.

About this page

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

Type a word or phrase to search the full documentation.