I use Drupal with the Domain Access module. In this, I have created a couple of sites with an '&' (ampersand) in the site name. For those who don't know: internally, the '&' is represented as '&'. You probably already know where I'm going now.
The site name shows up fine (as '&') in the title of the pages and in the Domains admin page (I'm using a Zen based theme).
So far, so good.
In the Domain switcher block and the Users admin page however, the '&' is printed as is, i.e. not translated back to '&'.
I think this might be a bug.
Fwiw: I've seen a non-Domain Access website with standard theme (Garland?) fail in the same way for the title, so I'm not sure what the official Drupal policy is for HTML entities in site names?
Comments
Comment #1
agentrickardCan you track back to the function that prints the title? It is likely being double-escaped (that is, run through check_plain() twice).
Comment #2
mreggie commentedFor the Domain switcher, the code (in domain.module) is:
If I change line 295 to
the output is correct. (I'm not suggesting that this is the right way to fix the problem, I would rather leave that to the experts.)
Comment #3
mreggie commentedFor the User admin page, the code (in domain.admin.inc) is:
When I
print print_r($form, 1), I see&'s in the site names.(I also see unencoded &'s in the role names in the source, which seems wrong too, but that's another problem.)
Unfortunately, I don't have a clue where the $form data is generated. Any tips?
Comment #4
agentrickardThe first instance, with the Domain Switcher Block, I cannot replicate.
I can replicate the user form, but that is by design (we could fix it by checking the $format of the display element). The problem is that checkboxes must be escaped with check_plain(), while select lists do not.
A patch would have to search for and correct all uses of
domain_select_format()so that we only use check_plain() if $format == TRUE.If I use an & in the site name, Drupal escapes it to & in its themed output (but not in the title tag of the page). So it would appear that HTML special chars are not expected or allowed.
This is all because l() runs check_plain() on the $title element.
Comment #5
mreggie commentedApparently, I specified the
&entity in the site name myself (or maybe the original site setup did so? I don't really remember). If I change the&to a simple '&' in the site name, everything is fine (with a check_plain for the title in the Zen theme).However, the Garland theme (which seems to be the theme to follow) brakes html entities in the site name, so probably '&' cannot be used safely in site names in Drupal. I'll take my chances for now.
So, no problem in Domain Access, sorry for the commotion.