After JHtmlBootstrap modification #3922, tab label contains slashes if language text (example in FR-fr) contains single quote.
1- Go to Administrator -> Extensions -> Langages -> Overrides
2- Add override with single quote :
3- Go to "Add New Menu Item"
4- Table label contains slash :
Tab label whithout slash before single quote
Joomla 3.6.0
It is necessary to add javascript safe when generating bootstrap tab ?
https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/edit/params.php#L52
$label = JText::_($fieldSet->label, true);
Labels |
Added:
?
|
Status | New | ⇒ | Confirmed |
In article tab, chain translation is not javascript safe.
administrator\components\com_content\views\article\tmpl\edit.php line 123
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'images', JText::_('COM_CONTENT_FIELDSET_URLS_AND_IMAGES')); ?>
But possibly same problem in :
administrator\components\com_plugins\views\plugin\tmpl\edit_options.php line 16
administrator\components\com_weblinks\views\weblink\tmpl\edit.php line 38 - 52 - 64
components\com_contact\views\contact\tmpl\default.php line 174
There are many occurences of bootstrap.addTab and none has addslashes added before the JText:: Good find!
it only concerns ' and not ` as this last one is not a quote in the php sense of the term.
I'm confused because I showed that the URLS and IMAGES tab works ok
issue is that we have 81 bootstrap.addTab
in core and adding addslashes() everywhere is not the perfect solution. We may need a better one that would be global. Don't know if possible.
Let me check further
in \layouts\libraries\cms\html\bootstrap\addtabscript.php line 19 , there is "json_encode" apply on title.
Maybe a change must be made on this file.
Yes it solve the issue but for example you also can change "layouts\joomla\edit\params.php" line 52
$label = JText::_($fieldSet->label, true);
by
$label = JText::_($fieldSet->label);
what is the best/correct solution ?
Maybe better in params.php:
If we use the second proposal I guess we also have to change the rest, i.e.
if (!empty($fieldSet->label))
{
$label = JText::_($fieldSet->label);
}
else
{
$label = strtoupper('JGLOBAL_FIELDSET_' . $name);
if (JText::_($label) == $label)
{
$label = strtoupper($app->input->get('option') . '_' . $name . '_FIELDSET_LABEL');
}
$label = JText::_($label);
}
Can you make a PR?
Yes I can do a PR.
It will also correct the problems in other files.
What I find very odd is that it doesn't happen on all views. Does this mean we render tabs in different ways in different places?
The jsSafe parameter should only be used if the text string is going to be used in Javascript code which is not the case for tabs.
I agree the fix in the params.php file should be good enough as we don't need Javascript escaping here.
Yes I agree
Do not escape the title to add tabs
What I found is that in some views using JText with jsSafe on tab title.
Same issue with jsSafe parameter in components/com_contact/views/contact/tmpl/default.php line 174
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-profile', JText::_('COM_CONTACT_PROFILE', true)); ?>
That will be great - thanks
If you have no time, I will do.
Take off the part concerning .gitignore
@infograf768 Yes you can do it.
I have 3 problems and I block :
I can write test process.
Thanks
OK, on it now
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-03 07:33:25 |
Closed_By | ⇒ | infograf768 |
Set to "closed" on behalf of @infograf768 by The JTracker Application at issues.joomla.org/joomla-cms/11400
Closing as we have a PR (Thanks @vinespie
I can confirm it on the menu tab but not the article tab and only when using the ' but not the `
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11400.