Skip to content

[#33067] JText::script is not loading Joomla core.js#3078

Closed
piotrmocko wants to merge 6 commits intojoomla:stagingfrom
piotrmocko:patch-13
Closed

[#33067] JText::script is not loading Joomla core.js#3078
piotrmocko wants to merge 6 commits intojoomla:stagingfrom
piotrmocko:patch-13

Conversation

@piotrmocko
Copy link
Contributor

JText::script should always load system JavaScript file: core.js which has declaration of function: Joomla.JText._ which should be used in JavaScript files for translating strings. If Mootools is not loaded or some other resource which is loading core.js then you will get an error trying to use: Joomla.JText._

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=33067

JText::script should always load system JavaScript file: core.js which has declaration of function: Joomla.JText._ which should be used in JavaScript files for translating strings. If Mootools is not loaded or some other resource which is loading core.js then you will get an error trying to use: Joomla.JText._
@Fedik
Copy link
Member

Fedik commented Feb 9, 2014

If you do use core.js for JText::script always, then I would suggest make there nicer: html/renderer/head.php#L220-L234

@piotrmocko
Copy link
Contributor Author

I have just changed as you have proposed. That is better solution.

@Fedik
Copy link
Member

Fedik commented Feb 9, 2014

you understood me wrong 😉
JHtml::_('script', 'system/core.js', false, true); can be where you did it first,
It will not work as you did now, because all scripts already rendered.

I mean other,
I mean that part of the code that on html/renderer/head.php#L220-L234 is unneeded after applying this pull request. So would be good clean up there 😄
This code is allow Joomla.JText works when core.js not loaded, but it have no sense if core.js will be available 😉

@Bakual
Copy link
Contributor

Bakual commented Feb 9, 2014

Currently, core.js has a dependancy on mootools. So you should never load core.js without mootools. Thus currently the way to load it is JHtml::_('behavior.framework');.
We will need a new way to load core.js as soon as it's rewritten for jQuery (or to use no dependancy at all). My suggestion would be to use a new function JHtml::_('behavior.core') by then. I made a PR a while ago to prepare for that: #3047.
I'm not a huge fan of loading it with JHtml::_('script', 'system/core.js', false, true); as this would still load mootools after it is converted to jQuery with #2687

@piotrmocko
Copy link
Contributor Author

Now I have made it incorrect. I am loading core.js to late. We can remove this part of code
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/html/renderer/head.php#L225-L229 and L231. Rest has to stay to load language strings.
I will have a look at core.js and maybe I will rewrite it to jQuery if there isn't already some PR

@piotrmocko
Copy link
Contributor Author

I have just updated with all yours suggestions.

@mbabker
Copy link
Contributor

mbabker commented Mar 9, 2014

Merged to 3.3-dev

@dbhurley
Copy link

@wilsonge mentions this is not present in staging or 3.4-dev. Re-opening to ensure it's merged.

@dbhurley dbhurley reopened this Jul 26, 2014
@Bakual
Copy link
Contributor

Bakual commented Jul 27, 2014

@piotrmocko Can you update the PR to use the new JHtml::_('behavior.core'); since it's available and rewritten to use jQuery since Joomla 3.3.

Compatibility with Joomla 3.3
@piotrmocko piotrmocko changed the title JText::script is not loading Joomla core.js [#33067] JText::script is not loading Joomla core.js Jul 29, 2014
@piotrmocko
Copy link
Contributor Author

I have just updated code to use new core dependence

@jissues-bot jissues-bot changed the title [#33067] JText::script is not loading Joomla core.js JText::script is not loading Joomla core.js Oct 17, 2014
@wilsonge wilsonge closed this in fbde32a Dec 23, 2014
@piotrmocko piotrmocko changed the title JText::script is not loading Joomla core.js [#33067] JText::script is not loading Joomla core.js Dec 23, 2014
@wilsonge wilsonge added this to the Joomla! 3.4.0 milestone Dec 23, 2014
@wilsonge
Copy link
Contributor

Merged this into staging again :) Thanks again!

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.

8 participants