Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
image.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Nov 2011 at 17:24 UTC
Updated:
24 Mar 2015 at 20:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettAttached both D7 and D8. Yay for cherry-pick.
Comment #2
tim.plunkettWhoops, dupe of #1025796: Rename path to uri in image functions
Comment #3
tim.plunkettReopening to get this in first, then rename path to uri.
Comment #4
robloachWould be nice if we just used straght up
$variablesthere instead of having to switch over to$imagefor Drupal 8. Save us a couple lines of code. For Drupal 7 though, it looks fine.Comment #5
robloach#1025796: Rename path to uri in image functions was committed, so this might not be needed for Drupal 8. For Drupal 7 though? Bot?
Comment #7
tim.plunkett#5: drupal-1329586-1.patch queued for re-testing.
Comment #8
jthorson commentedI'm thinking we should be checking $item['attributes'] as well as $variable['attributes'] ... if I'm working with upstream code that sets a 'title', 'alt', and 'fid' attribute on an image and then returns that image, these all get tacked on to $item.
If I want it to appear in $variables['#attributes'] for proper rendering with this patch, I would then have to pull the 'fid' out of $item and plug it into $variables['#attributes'] later in the pre-process function. This feels hackish to me.
That said, I can also see the benefit of being able to tack on '#attributes' when defining the render array.
How about something like this?
Comment #9
robloachWhat if it were to JUST check
$item['attributes']? Looking at theme_image_formatter(), we see "item: An array of image data."..... Then looking at theme_image(), we see that the image data is along side the "attributes".....Actually, I agree that we probably don't want to override it if it already exists... hmm.
Comment #10
tim.plunkettIt makes it a little clearer that the attributes are for the image, not for the possible link.
But it makes it harder to document.
Comment #11
robloach#10: drupal-1329586-10.patch queued for re-testing.
Comment #12
ultimateboy commented#10 works great. I think it's time to RTBC.
Comment #13
webchick1. We need some documentation of that newly accepted parameter.
2. Let's also add a test for this.
Comment #14
robloachIt's technically not a new parameter, as it was expected in theme_image(), but absolutely ignored in theme_image_formatter(). I'm with you that more documentation never hurts though!
Explicit test added!
Comment #16
ultimateboy commentedComment #17
jthorson commentedAnd just for the sake of completeness ...
Comment #19
jthorson commentedComment #20
ultimateboy commented#17: image-attributes-testonly.patch queued for re-testing.
Comment #21
robloachThe patch is missing the $item['attributes'] updates from #14.
Comment #22
robloachre-upped.
Comment #23
ultimateboy commentedAlright.. this is definitely ready to go.. good documentation, a test which has been shown to fail in #17 and a fully functional test-passing patch in #22.
Comment #24
jthorson commentedRobLoach: That was intentional. (ie. test-only). ;)
Comment #25
xjmHmm, can someone confirm that it's not needed in D8 (as per #5)?
Comment #26
robloachCorrect, Drupal 8 got the more elegant solution over at #1025796: Rename path to uri in image functions, and has been in since November. Drupal 7 just gets this simple
$item['attributes']check. I posted the difference between the branched patches right here.Ah, proof that this patch is needed :-) .
Comment #27
webchickCool, that looks great!
Committed and pushed to 7.x. Yay!
Comment #29
ñull commentedDoes this patch also include the title attribute? I have the title attribute set but I don't see it in the output.
Comment #30
ñull commentedComment #31
ñull commentedFalse alarm. It was a JS issue.