Editor Integration
The pieces of Method that shape the block editor itself rather than any one block: how Method blocks are grouped and named in the inserter, the data the theme hands every editor control, the colors that mark the responsive tiers, and the flag that gates responsive editing.
The Method collection
assets/js/method-block-collection.js registers a block collection named method with wp.blocks.registerBlockCollection() — titled Method, with the Method logo as its icon — so every method/* block is grouped under one heading in the inserter. It is enqueued on enqueue_block_editor_assets from lib/blocks.php, depends on wp-blocks and wp-element, and is versioned by METHOD_VERSION.
Top-level blocks carry a (Method) suffix — Section (Method), Swiper (Method) — rather than a prefix: the inserter ranks titles that begin with the search term higher, so typing “section” surfaces Method’s next to core’s. Every retitled block has a method keyword in its block.json, so searching “method” lists them all. Child blocks (Column, Row, Flex Item, Theme Button, Swiper Slide…) keep plain titles. Container-type blocks start with a placeholder paragraph through an inner-blocks template, not a template lock.
methodGlobalData
On enqueue_block_assets in the admin, lib/blocks.php localises one object onto a placeholder script, method-global-data, that every editor control reads instead of calling the REST API. A child theme that changes the config constant changes what the editor sees.
| Key | Source | Read by |
|---|---|---|
breakpoints | method_get_block_breakpoints() | Responsive tab help text, MethodStyleTag media queries, Swiper and Modal tier labels. |
breakpointPrefixes | method_get_breakpoint_class_prefixes() | Grid column classes. |
breakpointColors | method_get_breakpoint_colors() | Breakpoint colour-coding in controls (below). |
fontSizePresets | method_get_font_size_presets() | Typography controls. |
bsBreakpoints | method_get_all_bs_breakpoint_options() | MethodBreakpointSelect. |
socialNavItems | method_build_social_nav_items() | Social Nav editor preview. |
icons | method_get_theme_icons() | Every icon picker. |
Breakpoint colors
Each responsive tier has a colour so a control’s tier is readable at a glance: the Mobile / Tablet / Ultrawide tabs, the range tracks, toggles and tab badges inside each tier’s panel. The defaults live in lib/config.php under breakpoint-colors (enabled, mobile, tablet, wide); with enabled false every tier uses WordPress’s admin blue. method_get_breakpoint_colors() resolves them (child METHOD_CHILD_OPTIONS first), and lib/blocks.php prints the inline editor CSS that applies them and localises the same values as methodGlobalData.breakpointColors for controls that colour themselves.
'breakpoint-colors' => array(
'enabled' => true, // false: the default admin blue for every tier
'mobile' => '#d17c28',
'tablet' => '#2b9d9a',
'wide' => '#9b2d8c',
),
Responsive editing flag
method_configure_responsive_editing() (lib/theme-setup.php) adds responsiveEditingEnabled to the block editor settings on block_editor_settings_all. It is false unless the child theme declares add_theme_support( 'method-responsive-editing' ) or the method/responsive_editing_enabled filter returns true. It affects only the editing UI; saved responsive styles render regardless. No Method component reads it yet — it was added so the responsive tabs can be gated by it later.
WordPress 7.1 introduced an editor setting with the same name, used to hide core’s own responsive style controls. Because Method writes that key, Method’s default of false now also hides those core controls on 7.1 and later; declare the theme support to show them.
// Child theme functions.php
add_action( 'after_setup_theme', function () {
add_theme_support( 'method-responsive-editing' );
} );
// or, per request
add_filter( 'method/responsive_editing_enabled', fn( $enabled ) => current_user_can( 'manage_options' ) );
Changelog
| Version | Description |
|---|---|
| 2.0.0-alpha4 | Introduced: methodGlobalData and the breakpoint colour-coding of controls, with the defaults in lib/config.php (121d149, e9bc082). |
| 2.0.0-beta17 | Responsive editing flag: method_configure_responsive_editing(), method-responsive-editing theme support, method/responsive_editing_enabled filter (422194b). |
| 2.0.0-beta22 | The Method block collection, suffix titles, the method keyword and inner-content placeholders (93e1fcf). |
| 2.0.0-beta30 | Default breakpoint colors changed to #d17c28, #2b9d9a, #9b2d8c (3fc99f5). |