View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032227 | mantisbt | javascript | public | 2023-03-23 10:24 | 2023-04-08 14:11 |
Reporter | gatis | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | won't fix | ||
Product Version | 2.25.6 | ||||
Summary | 0032227: Feature to override the default javascript path in require_js function of html_api.php | ||||
Description | Currently there is no way to override the default path for javascript that is registered with require_js function. That means that if some plug-in has its own javascript file it has to be included in My suggestion would be to change the | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
The way I have dealt with this situation in the past myself, is to code the plugin's hook on EVENT_LAYOUT_RESOURCES to only include the javascript when the required conditions are met. See for example, https://github.com/mantisbt-plugins/source-integration/blob/8ef983dfb48b87b848f652bfce40d5bb575bc204/SourceGithub/SourceGithub.php#L52-L63 How do you propose to actually use the modified html_javascript_link() function to conditionally include javascript in the context of a plugin ? |
|
@dregad see "Additional Informatikon", there is PR https://github.com/mantisbt/mantisbt/pull/1872 |
|
I know, I'm the one who added the link there ;-) The PR describes the change to MantisBT core function, but does not say anything about how the modified function is expected to be used. |
|
Yeah.. I guess there is no way I will be able to use the function in the way I intended to.. So I guess @dregad proposed solution 0032227:0067520 is the way to go.. |
|
That's what I thought ;-) There is still some room for improvement though. I have not thought this all the way through, but we could introduce a new plugin_require_js() function, taking a script name, and maybe an optional list of pages where script should be included. In any case, based on your feedback, I guess your PR should be closed without merging ? |
|
Yes it should be closed. Sorry for trouble.. |
|
Thanks for the feedback. Closing as won't fix, feel free to reopen if you feel there is some use for this feature. And if you'd like to further analyze the idea of a new plugin API function and contribute a pull request, please open a separate issue. |
|