Commit 0ad09ef
authored
Make regClientScript and regClientHTMLBlock work in the manager (#16700)
### 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/82821 parent 8179e04 commit 0ad09ef
File tree
2 files changed
+11
-2
lines changed- core/src/Revolution
- manager/templates/default
2 files changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
791 | 790 | | |
792 | 791 | | |
793 | 792 | | |
| |||
798 | 797 | | |
799 | 798 | | |
800 | 799 | | |
801 | | - | |
802 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
803 | 808 | | |
804 | 809 | | |
805 | 810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
0 commit comments