User tests: Successful: Unsuccessful:
Pull Request for Issue #30933 .
Remove typehint for addInline() method, as it in registerAsset().
To support both types WebAssetItemInterface and String
add to index.php of the template:
$wa->addInlineScript(new \Joomla\CMS\WebAsset\WebAssetItem('inline.blabla', null, ['content' => 'alert(1);']));
$wa->addInlineScript('alert(2);');
an error
you get 2 alerts
none
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item
Confirm Actual Result/error and Expected result as @ceford. But I had to remove both lines via FTP. Think OK.
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
?
|
@SharkyKZ Does this PR solve everything which you've mentioned in the description of your issue #30933 ?
... and has broken code for handling WebAssetItem ...
Also wrong type of exception is thrown ...
If not, please re-open the issue and adapt the description of it, or make a new one for the remaining points.
Thanks in advance.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-10-15 17:38:16 |
Closed_By | ⇒ | richard67 | |
Labels |
Thanks!
I have tested this item✅ successfully on 1bb3013
Without the patch I get this error: 0 Argument 2 passed to Joomla\CMS\WebAsset\WebAssetManager::addInline() must be of the type string, object given, called in /Users/ceford/Sites/j4b4/libraries/src/WebAsset/WebAssetManager.php on line 193
With the patch I get two alerts. So - OK.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30986.