Something really weird is going on. Devel's Switch User block contains a list of links with usernames. Some of these usernames are formatted in the % style, i.e. with <em class="placeholder">. This works fine in the normal block, but not in the Dashboard!
In the Dashboard, the same HTML is sent, but the <em> tag (including the username inside!) is removed, presumably by some JavaScript. When I look at this in Firebug, then the <a> tag is empty!
The HTML looks like this (reformatted for readability):
<ul class="links">
<li class="1 first">
<a href="/devel/switch/Sysadmin?destination=admin/dashboard" title="This user can switch back.">
<em class="placeholder">Sysadmin</em>
</a>
</li>
<li class="32">
<a href="/devel/switch/Webmaster?destination=admin/dashboard" title="This user can switch back.">
<em class="placeholder">Webmaster</em>
</a>
</li>
<li class="30">
<a href="/devel/switch/Account?destination=admin/dashboard" title="Caution: this user will be unable to switch back.">Account</a>
</li>
<li class="33 last">
<a href="/devel/switch?destination=admin/dashboard" title="Caution: the anonymous user will be unable to switch back.">Anonymous</a>
</li>
</ul>
I see that the 'placeholder' class has some special use in dashboard.js, but this conflicts with established usage.
Dashboard.module should probably use 'dashboard-placeholder' instead.
Comment | File | Size | Author |
---|---|---|---|
#8 | drupal-dashboard_placeholder-908822-8.patch | 867 bytes | jmking |
#7 | after-patch.png | 18.52 KB | David_Rothstein |
#7 | before-patch.png | 18.31 KB | David_Rothstein |
#1 | dashboard_placeholder.patch | 1022 bytes | asimmonds |
Comments
Comment #1
asimmonds CreditAttribution: asimmonds commentedI thought I had already opened a issue on this a while back, apparently not..
I changed the placeholder usage to block-placeholder, as that is what is used in dashboard.css. Please try the attached patch.
Comment #2
salvisThe patch fixes my issue. It looks reasonable but I don't know jQuery well enough to really understand what it does.
The 'block-placeholder' class was already mentioned in the setupDrawer() function before this patch, so the patch probably has other effects besides avoiding the conflict with the pre-existing 'placeholder' class. Someone else needs to check whether that is correct.
Comment #3
sun.core CreditAttribution: sun.core commentedQuite an edge-case. Can and should be fixed, but doesn't qualify as major.
Comment #4
stevectorThis bug also affects usage of t() with %variable. It was reported again because Views uses t() in that manner in views_handler_field_date.inc
#1141562: Dashboard removes markup generated by t()
Because t() is such a common function is it appropriate to escalate the priority of this issue?
Comment #5
fredcy CreditAttribution: fredcy commentedThis bug also affects views_watchdog which formats watchdog.message and watchdog.variables using the t() function and generates HTML with 'placeholder' class values.
Comment #6
jmking CreditAttribution: jmking commentedI don't know about you guys, but I'm getting pretty tired of applying this patch on every core update. ;)
I think we have enough people here confirming this patch works correctly to mark this as RTBC
Comment #7
David_Rothstein CreditAttribution: David_Rothstein commentedI tested this patch and it messes up the styling in the case where the dashboard has an empty region (see attached screenshots).
Seems like this would need to be fixed with a new class (such as "dashboard-placeholder" which was originally suggested in this issue) rather than switching to an existing class that already has a different purpose.
Comment #8
jmking CreditAttribution: jmking commentedNice catch, David_Rothstein
Here's a new patch with the approach proposed by the OP instead.
Comment #9
dcam CreditAttribution: dcam commentedI tested #8. It corrects the issue that David_Rothstein shows in #7. Empty regions in the dashboard now have the class .dashboard-placeholder.
Comment #12
dcam CreditAttribution: dcam commentedComment #15
dcam CreditAttribution: dcam commentedComment #18
dcam CreditAttribution: dcam commentedComment #21
dcam CreditAttribution: dcam commentedComment #24
dcam CreditAttribution: dcam commentedComment #27
dcam CreditAttribution: dcam commentedComment #29
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks!