Skip to content

feat: builder-agnostic architecture, global token infrastructure, Bricks CPT font fix - #171

Merged
jackgranatowski merged 2 commits into
mainfrom
claude/gutenberg-integration-scope-jSOZX
May 31, 2026
Merged

feat: builder-agnostic architecture, global token infrastructure, Bricks CPT font fix#171
jackgranatowski merged 2 commits into
mainfrom
claude/gutenberg-integration-scope-jSOZX

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Move token infrastructure to global includes/Slashed_Token_Store, Slashed_CSS_Generator, Slashed_CSS_Loader, Slashed_Token_Page, and REST controllers are no longer Bricks-specific; renamed from Slashed_Bricks_* to Slashed_*, REST namespace changed from slashed-bricks/v1 to slashed/v1
  • Builder-agnostic CSS delivery — new Slashed_Core_Enqueue class in includes/ registers and enqueues the slashed-framework stylesheet on every WP site (frontend + block editor), with no builder required; Bricks integration now only adds its dark-mode bridge inline styles
  • De-Bricks admin UI — options page restructured into "CSS framework" (always active) + "Builder integrations (optional)" sections; description clarified that SLASHED works with any theme, not just Bricks
  • Fix Bricks Font Manager fonts missing in typography dropdownclass-fonts-rest.php now calls Bricks\Custom_Fonts::get_custom_fonts() to include fonts stored as a CPT (used by current Bricks versions), with a WP_Query fallback when the class isn't loaded; results feed into existing deduplication

Fixes included

  • Migration bypass: class-css-generator.php and class-inventory.php were calling get_option() directly, bypassing the one-time migration in Slashed_Token_Store::get_settings()
  • delete_settings() now also clears the legacy slashed_bricks_tokens option so a Reset All before first migration can't leave stale data
  • Standalone mode fatal: class-token-page.php used SLASHED_URL etc. unconditionally; added defined() guards with SLASHED_BRICKS_* fallbacks
  • Block editor html_font_size override was missing from enqueue_editor() — rem values in the iframed editor canvas now match the public frontend
  • Dev harness index.html still referenced window.slashedBricksApp; renamed to window.slashedApp

Test plan

  • Activate plugin without Bricks — confirm slashed-framework stylesheet loads on frontend and in block editor
  • Set html_font_size to 62.5% — confirm rem override appears in both frontend and block editor canvas
  • Open SLASHED admin > Tokens — confirm page loads, save/reset work via slashed/v1 REST routes
  • With Bricks active, open a page in Bricks builder — confirm slashed-framework loads in the canvas iframe, not in the builder panel chrome
  • Upload a custom font via Bricks Settings > Custom Fonts, then open SLASHED Typography tab — confirm the font appears in the dropdown
  • Reset All tokens — confirm both slashed_tokens and slashed_bricks_tokens options are deleted

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Custom fonts registered via the Font Manager are now automatically included in font API responses.
    • Enhanced font availability by aggregating custom fonts with standard font options.
    • Improved support for retrieving custom fonts with intelligent fallback mechanisms for better reliability.

Bricks stores custom uploaded fonts as a CPT (not in the
bricks_custom_fonts option). The fonts REST endpoint now calls
Bricks\Custom_Fonts::get_custom_fonts() when the class is available,
with a WP_Query fallback on BRICKS_DB_CUSTOM_FONTS for edge cases
where the class hasn't loaded yet. Both paths feed into the existing
deduplication step, so no duplicates appear if a font exists in both
storage locations.

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jackgranatowski, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 6 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d442197-1271-41b2-8096-62d5defd0684

📥 Commits

Reviewing files that changed from the base of the PR and between c11d07f and d8bfd30.

📒 Files selected for processing (1)
  • integrations/bricks/includes/class-fonts-rest.php
📝 Walkthrough

Walkthrough

This PR adds custom font collection to the Bricks font REST handler. The get_fonts() method now detects and integrates custom fonts from the Bricks Font Manager (CPT), using either the Bricks\Custom_Fonts class when available or falling back to direct post queries, then appends each discovered custom font to the REST response.

Changes

Custom Fonts Integration

Layer / File(s) Summary
Custom Fonts collection in REST handler
integrations/bricks/includes/class-fonts-rest.php
The get_fonts() method detects whether Bricks\Custom_Fonts exists and invokes get_custom_fonts(), or falls back to direct get_posts() query on BRICKS_DB_CUSTOM_FONTS CPT, then appends each discovered custom font family to the response list with source set to custom.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#163: Both PRs augment the same $fonts list in get_fonts() with additional Bricks-managed font families (this PR adds Custom Fonts; retrieved PR adds Google Fonts).
  • codeslash-dev/SLASHED#164: Both PRs modify the font REST response structure to include custom font data from Bricks, with alignment on the family and name field chain.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title lists three separate concerns (builder-agnostic, global tokens, Bricks fonts) but the changeset only implements the Bricks CPT font fix. Revise title to focus on the primary change in this specific file: 'feat: add custom Bricks fonts via CPT to REST handler' or similar, keeping broader refactoring titles for their respective files/commits.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/gutenberg-integration-scope-jSOZX

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@integrations/bricks/includes/class-fonts-rest.php`:
- Around line 132-133: The call to \Bricks\Custom_Fonts::get_custom_fonts() can
fatal if the class exists but the static method is missing or incompatible;
modify the branch that sets $cpt_fonts so it first verifies the method is
callable (e.g. method_exists('Bricks\\Custom_Fonts','get_custom_fonts') or
is_callable(['\\Bricks\\Custom_Fonts','get_custom_fonts'])) before invoking it,
and if not callable fall back to the existing CPT-based path (leave the CPT
logic intact); optionally wrap the call in a try/catch to safely handle runtime
errors from Bricks and ensure $cpt_fonts remains populated via the fallback when
the Bricks API is unavailable or incompatible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f53d4d18-2700-463d-bdd1-5f3061b50d31

📥 Commits

Reviewing files that changed from the base of the PR and between 1775672 and c11d07f.

📒 Files selected for processing (1)
  • integrations/bricks/includes/class-fonts-rest.php

Comment thread integrations/bricks/includes/class-fonts-rest.php Outdated
get_custom_fonts() is undocumented/internal in Bricks. Added method_exists()
check alongside class_exists() so a missing method doesn't fatal. Wrapped
the call in try/catch(\Throwable) so runtime errors from an incompatible
Bricks version fall through to the existing WP_Query CPT path instead.

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
@jackgranatowski
jackgranatowski merged commit e1c060d into main May 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants