Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Dec 2008 at 13:36 UTC
Updated:
1 Feb 2009 at 05:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
drewish commentedThis looks really good with the exception of these lines:
NULL should be in caps but I'd rather we just use an empty string ('').
Comment #2
sunAlso,
Missing blank line between switch cases.
Missing break for 'configure' case.
If we would use #type 'weight', or a simple select list, we would not have to verify that the value is an integer. IMO, a weight/select field with values from 1 to 99 would be the way to go.
Additionally, wrong indentation here in the form definition.
Comment #3
simon.males commentedI've taken all coding styling/standards suggestions on board with the attached patch. Rather then a free textfield the configuration is done by a select list (sun's suggestion). A new function called image_block_display_range() generates an array for #options.
Since the form is validated by the FAPI I don't see the need to wrap the input in an intval() anymore. Though I'm not sure of the best practice here. Is it taboo to store variables as strings if they are only going to used as integers?
Lastly, I updated the _uninstall hook so the module cleans up after itself.
Thanks for your suggestions.
Comment #4
sunThanks, committed attached patch.
@simon.males: Please take a close look at this patch and compare with your approach.
Comment #5
simon.males commentedI really appreciate bringing this to my attention.
drupal_map_assoc() is now obvious to me. Never needed to use it until now and it elegantly drops the need for a silly function.
I liked how you reduced code by using $delta directly rather then constantly running it through a switch.
Lastly I noticed the use of double quotes in variable_get/set which I wasn't aware about.
Cheers!
Comment #6
sunCommitted to 5.x-2.x as well.