Skip to content

Support custom design library locations - #1209

Merged
rahulacaleffi merged 12 commits into
release/M26.lanturnfrom
fix/expand-library-locations
Aug 5, 2026
Merged

Support custom design library locations#1209
rahulacaleffi merged 12 commits into
release/M26.lanturnfrom
fix/expand-library-locations

Conversation

@rahulacaleffi

@rahulacaleffi rahulacaleffi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎫 SMTNC-1912

The library hardening in 3.7.8.1 only accounted for the Kadence hosts and for libraries saved through Cloud Connect. Design libraries registered in PHP with the existing kadence_blocks_custom_prebuilt_libraries filter were left out, so their tab still opened in the editor but nothing inside it loaded: categories, patterns and previews all came back as Invalid Request, Unknown Library.

This PR widens the list of locations the editor can request. It brings kadence_blocks_custom_prebuilt_libraries back into play and adds a new kadence_blocks_allowed_library_urls filter for adding or removing locations, while keeping the list built server-side so it stays under the site owner's control. A site owner can also drop URLs straight into the array in the plugin, if necessary, even though the filter is the one always recommended.

Detailed breakdown:

  • API_Url_Trait::get_allowed_library_urls() merges the Kadence hosts, saved Cloud Connect connections and libraries registered in PHP, and has a commented spot for a site owner to add their own.
  • New kadence_blocks_allowed_library_urls filter for adding or removing a location without editing the plugin.
  • A location the editor could not load is recorded, and an admin notice lets a site manager approve or dismiss it. Approved locations are stored and merged into the list above. Recording and approving are both limited to users who can manage options.
  • Matching is by host, subdomains included, so a connection saved with a trailing slash and a starter pack served from a subdomain both work again.
  • Fixed the design library sidebar erroring when the remembered tab no longer matches an available library, which left the block unable to render.
  • Existing integrations need no changes on their side.
  • Tests cover both filters, host and subdomain matching, saved connections, and malformed input.

Checklist

  • I have performed a self-review.
  • No unrelated files are modified.
  • No debugging statements exist (Ex: console.log, error_log).
  • There are no warnings or notices in the wordpress error log.
  • Passes all tests (linting, acceptance, & unit)

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 Zip build complete

Build timestamp

@rahulacaleffi
rahulacaleffi marked this pull request as draft August 4, 2026 00:18
@rahulacaleffi
rahulacaleffi changed the base branch from master to release/M26.lanturn August 4, 2026 12:02
@rahulacaleffi rahulacaleffi self-assigned this Aug 4, 2026
@rahulacaleffi
rahulacaleffi marked this pull request as ready for review August 4, 2026 13:19
@linear

linear Bot commented Aug 4, 2026

Copy link
Copy Markdown

SMTNC-1912

@rahulacaleffi
rahulacaleffi requested a review from mauteri August 4, 2026 15:57
@rahulacaleffi
rahulacaleffi requested a review from bordoni August 5, 2026 12:55
@rahulacaleffi

rahulacaleffi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@bordoni , requesting your review again since a couple changes have been pushed. Thanks in advance.

  1. Added the option to approve/disapprove URLs, if they were added via 'enqueue_block_editor_assets' (JS).
  2. A small fix for a bug found during the tests, that was preventing Design Library modal to open, in case a Connection Cloud added doesn't exist anymore.

Artifact:
Screenshot 2026-08-05 at 10 01 35 AM

@gilbert-hernandez gilbert-hernandez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. I remember hoping that the allowlist was correct in 3.7.8.1.

@rahulacaleffi
rahulacaleffi merged commit 624819c into release/M26.lanturn Aug 5, 2026
23 checks passed
@rahulacaleffi
rahulacaleffi deleted the fix/expand-library-locations branch August 5, 2026 17:27
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.

3 participants