Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make regClientScript and regClientHTMLBlock work in the manager #16700

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

halftrainedharry
Copy link
Contributor

What does it do?

Adds scripts registered with regClientScript() or regClientHTMLBlock() to the output in the manager.

Why is it needed?

There is some inconsistency:
The modX class has the 4 functions regClientScript(), regClientHTMLBlock(), regClientStartupScript() and regClientStartupHTMLBlock().
On the frontend (outputting a resource) all 4 functions work.
In the manager, the functions regClientStartupScript() and regClientStartupHTMLBlock() work, but scripts registered with regClientScript() and regClientHTMLBlock() are ignored.


If there is a reason why these functions shouldn't work in the manager, then at least the MODX documentation (and the source code) should be updated to clearly state that this is the case.

How to test

  • Create a plugin that uses the functions $modx->regClientScript() and $modx->regClientHTMLBlock() on a manager event (like e.g. OnManagerPageBeforeRender).
  • Make sure the scripts get added to the HTML output.

Related issue(s)/PR(s)

Related discussion in the MODX forum: https://community.modx.com/t/13-years-and-6-months-regclientscript-still-not-working/8282

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 21.53%. Comparing base (b1a02c3) to head (704adab).
Report is 17 commits behind head on 3.x.

Files with missing lines Patch % Lines
core/src/Revolution/modManagerController.php 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##                3.x   #16700   +/-   ##
=========================================
  Coverage     21.53%   21.53%           
  Complexity    10734    10734           
=========================================
  Files           565      565           
  Lines         32540    32547    +7     
=========================================
+ Hits           7007     7010    +3     
- Misses        25533    25537    +4     

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

@modxcommunity
Copy link
Collaborator

This pull request has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/13-years-and-6-months-regclientscript-still-not-working/8282/14

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