feat(bricks): reBEMer tab with enable toggle, Colors launcher toggle, and container rename rows - #69
Conversation
- Bricks settings → Options: new toggles to enable/disable reBEMer (the in-builder BEM badges + panel) and the bottom-right "Colors" launcher pill. Backed by new rebemer_enabled / show_color_panel plugin settings; the editor bundle gates the badge pipeline on rebemerEnabled and the color launcher on showColorPanel (the latter still honors the slashed_bricks/show_color_panel filter, now defaulting to the setting). - Element names table now lists the layout containers (section / container / div / block). They default to their own Bricks type; an override wins, and suggestContainerName consults the merged override map so it applies in the builder. - Wire the two booleans through the REST settings allow-list, save, and import paths for parity; surface containers in the standalone admin SPA tab too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Rename the "Element names" tab to "reBEMer" (now the default tab) and put the reBEMer enable/disable toggle at the top of it, above the element default-name table — both saved by a single form (handle_save_rebemer). The Options tab keeps the Color System launcher and Class hints toggles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
📝 WalkthroughWalkthroughRenames the Bricks Settings "Element names" tab to "reBEMer", adds a master ChangesreBEMer Settings & Toggle Wiring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php (1)
86-91: 💤 Low valueConsider clarifying the container naming comment.
The comment on line 88 states "Layout containers are always named after their Bricks type", but with the new override functionality introduced in this PR, containers can be customized via the admin settings table. The word "always" may confuse future maintainers.
📝 Suggested clarification
// reBEMer default-naming config: sparse type → BEM-name // overrides merged over the built-in map editor-side. -// Layout containers are always named after their Bricks type. +// Layout containers default to their Bricks type name (overridable). 'rebemerElementMap' => isset( $plugin_settings['rebemer_element_map'] ) && is_array( $plugin_settings['rebemer_element_map'] )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php` around lines 86 - 91, Clarify the container naming comment in the editor data setup because “always” is no longer accurate now that admin overrides can customize container names. Update the comment near rebemerElementMap in class-editor-data.php to reflect that the default is to use the Bricks type, but it may be overridden by the plugin settings map. Keep the note aligned with the new override behavior so future maintainers understand the naming source.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php`:
- Around line 86-91: Clarify the container naming comment in the editor data
setup because “always” is no longer accurate now that admin overrides can
customize container names. Update the comment near rebemerElementMap in
class-editor-data.php to reflect that the default is to use the Bricks type, but
it may be overridden by the plugin settings map. Keep the note aligned with the
new override behavior so future maintainers understand the naming source.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3336de8f-a279-4137-9b3d-32e064691fb9
📒 Files selected for processing (12)
CHANGELOG.mdSLASHED-for-WP/includes/class-bricks-settings-page.phpSLASHED-for-WP/includes/class-rest-controller.phpSLASHED-for-WP/includes/class-token-store.phpSLASHED-for-WP/integrations/bricks/admin-app/src/components/RebemerTab.svelteSLASHED-for-WP/integrations/bricks/assets/admin-app/app.jsSLASHED-for-WP/integrations/bricks/assets/editor-app/app.jsSLASHED-for-WP/integrations/bricks/editor-app/src/lib/element-types.jsSLASHED-for-WP/integrations/bricks/editor-app/src/main.jsSLASHED-for-WP/integrations/bricks/includes/class-editor-data.phpdocs/rebemer.mdtests/element-types.test.js
There was a problem hiding this comment.
1 issue found across 12 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
- Bump the plugin's own release version to 0.3.5 (package.json + plugin Version: headers + SLASHED_*_VERSION constants) so it matches the readme Stable tag main already declared, clearing the verify-sync drift failure. - Clarify the editor-data + standalone admin-tab notes: layout containers default to their Bricks type but can be overridden (no longer "always"). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Summary
Builds on the merged Bricks-settings consolidation (#68) with three user-requested additions, organised into a dedicated reBEMer tab.
The Bricks settings page now has three tabs:
Changes
Enable/disable reBEMer — new
rebemer_enabledplugin setting + toggle at the top of the reBEMer tab. The editor (main.js) gates the structure-panel BEM badge pipeline oncfg.rebemerEnabled; the colour tools stay independent (the Bricks probe still runs).Enable/disable the bottom-right "Colors" launcher — new
show_color_panelsetting + toggle in the Options tab.class-editor-data.phpuses that setting as the default for the existingslashed_bricks/show_color_panelfilter (filter still wins for programmatic overrides);main.jsalready gated the launcher onshowColorPanel.Containers in the rename list —
section / container / div / blocknow appear in the reBEMer element table. They default to their own Bricks type (placeholder) and an override wins:suggestContainerNameconsults the merged override map, so e.g.container → wrapperapplies in the builder. Mirrored in the standalone admin SPA tab.Tab restructure — renamed the old "Element names" tab to reBEMer (now the default) and moved the enable toggle into it above the element table; one form (
handle_save_rebemer) persists bothrebemer_enabledand the override map.Plumbing: both new booleans are wired through the REST settings allow-list, save, and import paths; defaults added to
PLUGIN_SETTING_DEFAULTS(required since the store whitelists keys).Testing
php -lclean on all changed PHP; both Vite bundles (editor-app + admin-app) rebuilt and confirmed to carryrebemerEnabled.🤖 Generated with Claude Code
https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Generated by Claude Code
Summary by cubic
Adds a dedicated reBEMer tab with an enable toggle and container rename support, plus an option to show/hide the bottom‑right Colors launcher. This gives admins quick control over BEM tooling and default names across all elements, including layout containers.
New Features
rebemer_enabledto show/hide the BEM badges and panel in the builder; the editor gates onrebemerEnabled. The element default-name table now listssection/container/div/block; they default to their own type, and an override inrebemer_element_mapwins. Both the toggle and table save together.show_color_panel). Used as the default for theslashed_bricks/show_color_panelfilter; the filter still overrides. Added bothrebemer_enabledandshow_color_panelto REST save/import and plugin defaults.Bug Fixes
package.json,slashed.php,integrations/bricks/slashed-bricks.php, andintegrations/gutenberg/slashed-gutenberg.phpto clear release-tooling drift.Written for commit ff3e2c6. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation
Tests