When we need to go in and add a title_suffix (i.e. if we are on Page 2 or more), we call drupal_get_title() to get the page title, but Drupal gives this back to us encoded, that is, after a check_plain.
We need to decode this because something else is happening to it again. Alternatively, we need to use a different function that drupal_get_title() in order to find the page title.
This is a (very simple) patch to decode the entities (including quotes). (This was generated from a git diff so I wasn't sure if this would actually be a valid patch file, but since the fix is so simple, I thought displaying it might be enough.)
--- a/sites/all/modules/smart_paging/smart_paging.module
+++ b/sites/all/modules/smart_paging/smart_paging.module
@@ -582,7 +582,7 @@ function smart_paging_field_attach_view_alter(&$build, $context) {
}
$markup_content = $field_content['#markup'];
if ($current_page > 0) {
- $title_suffix = drupal_get_title() . t('@page', array('@page' => $suffix . ($current_page + 1
+ $title_suffix = htmlspecialchars_decode(drupal_get_title(), ENT_QUOTES). t('@page', array('@p
drupal_set_title($title_suffix);
}
}
Comments
Comment #2
rwohlebSubscribe.
Comment #3
arpeggio commentedHi, what version are you using? The line code that needs replacement in your patch doesn't exist anymore. Thanks.
Comment #4
farshid commentedHi
Facing same problem in 7.x-1.3 in smart_paging.module on line: 1176
Problem: a title with single quote like: "this is it's :)"
go to page 2 and you should see: "this is it
's :) : Page 2 of 2"my solution: add PASS_THROUGH to drupal_set_title on line 1176 so that would be:
Works, but we may need to check_plain the $title_suffix too (I do not know if some user with admin permissions could add some sort of XSS,... to the suffix or not):
one thing I was wondering: why a second call to check_plain converts single quote to
'??test:
prints:
Comment #5
arpeggio commentedHi, I have tested/committed/pushed your patch. Please use the dev version. Thank you for the patch.
Comment #7
ronny89 commentedset proper version