Noticed this issue when adding a media pane, but was able to reproduce when adding HTML/links/maps/text etc, entering a title with an '&', and checking 'Make title a link.' When the pane displayed, the title was made a link successfully, but instead of displaying the '&', it displayed &. This is a non-issue if the 'Make title a link' checkbox is not checked, which led me to the following code in fieldable_panels_panes_preprocess_panels_pane in fieldable_panels_panes.module:
if ($entity->link && !empty($vars['title'])) {
$vars['title'] = l($vars['title'], $entity->path);
}The call to the l() function is sanitizing the title a second time via check_plain(), which leads to the escaped '&' displaying. To prevent this, I will be posting a patch shortly which bypasses the check_plain for the text by passing html->TRUE in the options array (see l() function for more detail - https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7).
Proposed change:
if ($entity->link && !empty($vars['title'])) {
$vars['title'] = l($vars['title'], $entity->path, array("html" => TRUE));
}The title is sanitized via a call to filter_xss_admin in fieldable_panels_panes_fieldable_panels_pane_content_type_render in fieldable_panels_pane.inc, so this should not be a security issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | fieldable_panels_panes-n2508629-8.patch | 3.06 KB | damienmckenna |
Comments
Comment #1
malik.kotob commentedpatch for 7.x-1.x branch attached
Comment #2
malik.kotob commentedComment #4
malik.kotob commentedComment #6
damienmckennaThis needs some tests to confirm that the titles work correctly.
Comment #7
Jacqs commentedThe #2508629-1: Special characters in title not displaying properly when title is a link patch fixed the issue in my environment, thanks.
Comment #8
damienmckennaThis adds a test.
Comment #10
damienmckennaCommitted.