Jump to content

Quotes in Summary of Module Info


kixe
 Share

Recommended Posts

Qotes (single or double) in the summary (Array Element of ModuleInfo)  will be displayed '&quote;' or ''' which means the output of the html-source is: '&quote;' or '''.

Didn't check the cause.

Maybe better to avoid the use of quotes in the summary respectively in translations (.json).

Link to comment
Share on other sites

The case would no doubt be entity encoding. It sounds like maybe double entity encoding? I did just try adding quotes to the summary for Helloworld.module, and am not seeing double entity encoding though. 

Link to comment
Share on other sites

Yes there must be one htmlspecialchars too much. Cannot find the second one, maybe until rendering the table as a form value?
If I take away the first one it works.

ProcessModule.module
Line 128:

$summary = empty($info['summary']) ? '' : htmlspecialchars($info['summary']);
 

Line 182:

$form->attr('value', $out); //call of modules > InputfieldForm/ InputfieldWrapper
 
Link to comment
Share on other sites

I got it:
I made the summary in my modules translatable like:
'summary' => __('Here comes the text'),

This function does a second entity encoding.
 

Is it useful to edit the following line in ProcessModule.module to prevent from double encoding?

Line 128:

            $summary = empty($info['summary']) ? '' : htmlspecialchars(htmlspecialchars_decode($info['summary']));

 
Link to comment
Share on other sites

Okay that makes sense. We entity encode everything coming from the translation functions for security. I believe that htmlspecialchars/htmlentities have a boolean argument that when 'true' can tell it to not double-encode. But for a quick solution in your case, you could update that line in your module to this (below), and I'll update the ProcessModule to have that boolean argument. 

'summary' => html_entity_decode(__('Here comes the text')), 
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...