Skip to content

Update Resource preview to support settings tag in Weblinks#16954

Open
smg6511 wants to merge 2 commits into
modxcms:3.xfrom
smg6511:3.x-preview-support-id-in-setting
Open

Update Resource preview to support settings tag in Weblinks#16954
smg6511 wants to merge 2 commits into
modxcms:3.xfrom
smg6511:3.x-preview-support-id-in-setting

Conversation

@smg6511

@smg6511 smg6511 commented May 26, 2026

Copy link
Copy Markdown
Collaborator

What changed and why

Added condition in getPreviewUrl to take system settings (including ones created by Extras like ClientConfig) into account and parse them before checking validity. Previously, Weblinks with valid targets (Resource or static URLs) supplied by a setting tag would cause preview to fail and an error message to be logged.

How to test

  1. Create a system setting and store either the ID of an existing, viewable Resource or a static URL.
  2. Use this setting as the content value in a new Weblink.
  3. Verify that the "View" button (as well as context menu item in the tree) is active and leads to the expected Resource or website.

Related issue(s)/PR(s)

This PR addresses the issue raised in the MODX Community forum by @SnowCreative.

Compatibility notes

n/a

Breaking change assessment

n/a

Test coverage

No pre-existing tests for this method; none currently planned.

Contributors

See related issues above.

AI tool use

n/a

smg6511 added 2 commits May 26, 2026 00:44
Adds parsing of setting tags used in weblinks
Tweak section documentation
@smg6511 smg6511 requested review from Mark-H and opengeek as code owners May 26, 2026 05:14
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.67%. Comparing base (5a484de) to head (3c5699b).
⚠️ Report is 12 commits behind head on 3.x.

Files with missing lines Patch % Lines
core/src/Revolution/modResource.php 0.00% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.x   #16954      +/-   ##
============================================
- Coverage     21.67%   21.67%   -0.01%     
- Complexity    10786    10791       +5     
============================================
  Files           566      566              
  Lines         33149    33170      +21     
============================================
+ Hits           7186     7189       +3     
- Misses        25963    25981      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@smg6511 smg6511 changed the title Update Resource preview to support settings tag in Weblink Update Resource preview to support settings tag in Weblinks May 26, 2026
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.

1 participant