Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
7 Oct 2012 at 11:22 UTC
Updated:
29 Jul 2014 at 21:17 UTC
Jump to comment: Most recent file
Comments
Comment #1
larowlanTagging
Comment #2
larowlanTagging
Comment #3
larowlanRelated #1778990: Merge theme_pager_link*() theme functions into theme_link()
Comment #4
_wdm_ commentedComment #5
_wdm_ commentedComment #6
_wdm_ commentedComment #7
mgifford@_wdm_ That's a really simple solution just removing check_plain(). I'm sure there are implications for this however. Maybe not.. Any thoughts as to what we're loosing by doing this?
Comment #8
tstoecklerWell, we currently use check_plain() as a matter of security. That way you can do
But the JavaScript is actually not executed.
The function theme_link() supports $variables['options']['html'], I think we should do the same here. See http://api.drupal.org/api/drupal/core!includes!theme.inc/function/theme_...
Note that because of the above, this would automatically be fixed by #1778990: Merge theme_pager_link*() theme functions into theme_link(), so I don't know if this should simply be marked duplicate.
Comment #9
_wdm_ commentedThe change was simple as another patch had already replace the l() function. I when for removing check_plain as that is how l() implements the html option. The new patch has added $variables['options']['html'].
Looking at the logic in theme_pager_link() I don't think it can be merged into theme_link(), however the end of theme_pager_link could use theme_link instead of repeating the build of the html output (but that isn't part of this issue).
Comment #10
tstoecklerLooks great! Some minor remarks:
Instead of the "(default FALSE):", I think we usually do a "Defaults to FALSE." at the very end. Also we should be referencing "$variables['text']" and not "$text", because the variable in the PHPDoc is $variable. I'm not sure we need the explanation with the image tag. The (currently) last sentence is very important, though!
In theme_link() we check $variables['options']['directly'] without setting another variable. I think it would be most consistent to declare $options up top, and then reference $options['html'] below.
Also the patch needs to update drupal_common_theme() to reference the new parameter.
Marking needs work.
Comment #11
_wdm_ commentedDone, I have also added options to the other pager link theming functions (otherwise it isn't much use):
Comment #12
tstoecklerThat looks great. I had forgotten about the other pager theme functions, nice one! I was about to mark this RTBC, but I thought maybe we should have some tests for this.
I would think adding a new function (something like
testHTMLTestor whatever) to PagerTest would be enough. That could probably use assertThemeOutput().Comment #13
bleen commentedSlightly related: #1598886: Clean up pager theme functions
Comment #14
_wdm_ commentedI have added a test for theme_pager_link.
Comment #16
tstoecklerNice work on the tests. Great job bringing a < blink > tag into the core codebase! :-)
I think after some minor comment touch-ups (and the fixing of the tests), we can call this done:
Perhaps: "Tests HTML and plain text in the pager link title."
1. "html" should be "HTML".
2. This could use a little longer description for clarity. Maybe something like (feel free to improve on this): "Test plain text as pager text with HTML input disabled.", "Test HTML as pager text with HTML input enabled.", "Test that HTML as pager text with HTML input disabled gets stripped."
There should be no spaces after the opening and before the closing parenthesis.
Can't check right now why the tests are failing.
Comment #17
tstoecklerRegarding the tests:
1. It seems you need to do 'text' => 'next >', instead of 'text' => 'next' to get the 'title' attribute.
2. You need to dynamically figure out the 'href' attribute. Probably use url() for that.
Comment #18
_wdm_ commentedComment #19
tstoecklerSorry, but I found something to complain again... :-)
Typo: generated -> generate
I don't think we need a static here, this function should only be called once.
Hmm... I guess since we're really only interested in the title and the pager markup is tested elsewhere, it may be a good idea to not use assertThemeOutput() here, but only assert on the title (not sure yet...). If so, we should not use assert() here directly, rather assertTrue(strpos($output, '>next') !== FALSE). The two different assert messages really are non-standard in core. This also goes for the other two assertions of course.
Comment #20
_wdm_ commentedI have removed generating the URL as it isn't needed any more.
I have also removed the two different assert messages.
Comment #21
tstoecklerThat looks great! Thanks for sticking with this.
Comment #22
sunWould be great if we'd do #1598886: Clean up pager theme functions first -- that one has been ready for a long time already, and committing it first will only result in diff hunks to remove here.
Comment #23
tstoecklerI'd volunteer to re-roll that one in case this gets in first. Should be equally trivial.
Comment #24
catch#20: theme_pager_link-1805678-20.patch queued for re-testing.
Comment #26
mgifford#20: theme_pager_link-1805678-20.patch queued for re-testing.
Comment #28
mgiffordI tested this locally on a fresh repo to see if the patch would apply. I had no problems. This is a buggy bot I think.
Comment #29
sunGiven where #1778990: Merge theme_pager_link*() theme functions into theme_link() is heading, I wonder whether it makes sense to do this.
Actually, I just "merged" the needed change into that.
Comment #30
_wdm_ commented#20: theme_pager_link-1805678-20.patch queued for re-testing.
Comment #32
_wdm_ commentedCan this issue be closed as as duplicate?
Comment #33
tstoecklerI guess it probably makes sense, your call though, @wdm, you worked on this. We should still port the tests from here to that issue, though.
Comment #34
_wdm_ commented