Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The documentation for image_filter_keyword()
doesn't describe the function parameters nor the value the function returns. Both should be added.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff-5-11.txt | 795 bytes | jungle |
#11 | 3097797-11.patch | 1.37 KB | jungle |
Comments
Comment #2
apadernoI would also change the name of the first parameter, as
$value
is a bit too vague.Comment #3
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedComment #4
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedAdding patch to update description for parameters and return value.
Comment #5
apadernoGiven the code that calls that function, I would change the function description and add the parameters description as in the following patch.
Comment #6
apadernoThe method I am referring in my previous comment is
CropImageEffect::applyEffect()
, which contains the following code.Comment #8
Kristen PolTagging this issue for new contributors to work on during the Friday DrupalCon Global sprint.
Comment #9
ultrabob CreditAttribution: ultrabob commentedThe patch applied cleanly and I thoroughly tested The crop and scale and crop image effects that use this function. They all continue to work as expected.
I agree that the new parameter names are much easier to understand, and the docblock does a nice job of explaining what the function does. I don't think the function name
image_filter_keyword
is very intuitive, but I don't have a better idea either.It is a good improvement, and is in good working order.
Comment #10
apadernoYes, the function name would make me think it filters text to give a keyword. Without seeing code that uses that function, I would not have imagined its purpose.
I thought of changing the function name too, but I also thought to replace the function with a class method. The problem in this case is finding the right class; given it's called from two image effect plugins, replacing it with a
ImageEffectBase
's method could make sense, but it would not consider which third-party modules use that function. (Some of those modules would probably not expect to deal with the image effects base class.)Comment #11
jungleRedundant trail whitespace.
Could move to
default
inswitch
, for better readabilityAddressing the above two points. Meanwhile, would be better adding unit tests for image_filter_keyword(), but not sure if it's in scope, so stay RTBC.
Comment #12
Kristen PolI double checked the changes in #11 and they seem ok to me.
Please note that @ultrabob in #9 was working with me and @mradcliffe during the DrupalCon Global contribution day. I do see now that there are no screenshots so let us know if those need to be added to move this forward. Thanks.
Comment #13
apaderno@KristenPol Screenshots of code aren't much helpful.
Everybody can verify the patch contains trailing spaces that need to be removed. A screenshot could eventually be a further prove that what reported is correct, but the confirmation of other users (including the user who provided the patch) should be sufficient.
(I shall remember to set Sublime Text to show the line endings, before creating a new patch.)
Comment #14
Kristen PolRight. Sorry, I was confusing this with a different issue that could be tested via the UI. Sorry for the noise.
Comment #15
apaderno@KristenPol Asking what needs to be done to make a patch progress isn't noise at all. It's better to ask, when there are doubts.
Comment #16
alexpottCommitted 0eb1d66 and pushed to 9.1.x. Thanks!