Install any system plugin (or edit an existing one to test it) and write (or modify an existing onAfterRoute() function)
public function onAfterRoute() {
JHtml::_('jquery.framework');
}
jQuery added in document scripts.
Error: 0 Call to a member function getWebAssetManager() on null
Location: JROOT\libraries\src\HTML\Helpers\Jquery.php:48
Joomla 4 Beta 5
PHP 7.2.10
I believe that the PHP version is irrelevant, as well as any other system information.
This occurs at JROOT\libraries\src\HTML\Helpers\Jquery.php, line 48
46: public static function framework($noConflict = true, $debug = null, $migrate = false)
47: {
48: $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
The document property of the Application object is null.
Same happens both in the front-end (SiteApplication) and the back-end (AdministratorApplication).
Maybe it's not supposed to work at that point anyway, but it worked on Joomla 3, so I thought I should mention it.
@Fedik Yes, I tried that and it seems to work. Also onBeforeCompileHead()
. However, I thought it was worth mentioning somewhere, because it worked differently on Joomla 3.
@joeforjoomla I agree.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-12 15:00:56 |
Closed_By | ⇒ | joomdonation | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
Closing this issue because the user who reported this issue had solution for this problem. Anyone has similar issue, please look at @Fedik answer above #31415 (comment)
hmhm, that because Document not exists in Application until dispatch happen
joomla-cms/libraries/src/Application/SiteApplication.php
Lines 135 to 146 in 52cf46e
I would suggest just move your JHtml::_('jquery.framework'); to onAfterDispatch event