Skip to content

fix(fonts): use title as family name fallback for Bricks custom fonts - #164

Merged
jackgranatowski merged 1 commit into
mainfrom
claude/fonts-custom-title-fallback
May 30, 2026
Merged

fix(fonts): use title as family name fallback for Bricks custom fonts#164
jackgranatowski merged 1 commit into
mainfrom
claude/fonts-custom-title-fallback

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fonts added via Bricks > Settings > Custom Fonts (including Google Fonts downloaded for local serving) store the CSS family name only in title — no separate font_family or family key. The previous fallback chain (font_family ?? family ?? null) skipped these entries entirely, so the Bricks tab never appeared for these users.

Extended the fallback chain to:

font_family ?? family ?? title ?? name

Same fix applied to the bricks_google_fonts block for consistency.

Changed files

  • includes/class-fonts-rest.php — extended family name fallback chain in both the custom and Google fonts blocks

https://claude.ai/code/session_018u9uVFxgL7K6EpPjZPggKR


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved font detection and fallback logic for custom and Google fonts, using additional title/name/font-family fallbacks so fonts display more reliably.
    • Labels now derive more robustly from title/name/family, invalid entries are excluded, and results are deduplicated case-insensitively for consistent cataloging.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

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 53 minutes and 22 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: 30713b5d-05b3-425f-af3d-d455ff4fa597

📥 Commits

Reviewing files that changed from the base of the PR and between 15e72e1 and 114e3d5.

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

Walkthrough

The Slashed_Bricks_Fonts_REST::get_fonts() method now uses expanded fallback key lookup orders when deriving font family names from the Bricks options schema. Custom fonts try font_family, family, title, and name in sequence; Google fonts try family, font_family, name, and title. Updated inline comments document these schema variants.

Changes

Font family name resolution with expanded schema fallbacks

Layer / File(s) Summary
Font family name resolution with expanded schema fallbacks
integrations/bricks/includes/class-fonts-rest.php
Custom-font parsing (lines 67–73) and Google-font parsing (lines 93–95) both expand their CSS family name fallback lookup order to probe additional schema keys, handling more Bricks option variants robustly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#163: Both PRs update Slashed_Bricks_Fonts_REST::get_fonts() to handle Bricks Google fonts from bricks_google_fonts, so the main PR's REST parsing changes directly support #163's Google-font inclusion work.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main change: extending the family name fallback to include 'title' for Bricks custom fonts, which is the primary fix addressing the issue where fonts lack font_family or family keys.
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/fonts-custom-title-fallback

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.

@jackgranatowski
jackgranatowski force-pushed the claude/fonts-custom-title-fallback branch from b650af1 to 15e72e1 Compare May 30, 2026 20:30
…onts

Bricks' locally-served Google Fonts (downloaded via Custom Fonts) store
the CSS family name only in 'title', with no separate 'font_family' or
'family' key. The previous fallback chain skipped these entries entirely,
so the Bricks tab never appeared for users who added fonts that way.

Extended the chain to: font_family ?? family ?? title ?? name
Same fix applied to the bricks_google_fonts block for consistency.

https://claude.ai/code/session_018u9uVFxgL7K6EpPjZPggKR
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