Closed (fixed)
Project:
Countries
Version:
7.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 May 2011 at 19:05 UTC
Updated:
23 Jun 2011 at 03:31 UTC
Fields in drupal 7 have always the same array structure.
field_name (Array, 1 element)
und (Array, 1 element)
0 (Array, 3 elements)
value (String )
safe_value (String )
....
But the country field as no value they are a good reason for that? I like to have the country object but I also nice to have a value item.
Comments
Comment #1
alan d. commentedCountry name be ok? The value field (or equivalent field) is normally the key value, which would be the iso2 value, but this is not that useful in the average site. The object is far more useful IMHO, but I could easily add this in. Take care that not all fields use the same field named 'value'.
Comment #2
alan d. commentedLooking at the code the safe field contains a safe version of the country name, ready for use. Simply use this to get the name if required
Comment #3
johnvgagarine has a point: confirming to standard structure names is easier in developing/debugging.
I have browsed other fields:
term: tid
integer: value
formattable text field: value, format, safe_value
You might consider
- renaming 'safe' to 'safe_value'
- creating 'value' (but not sure what it would contain iso2? country name?)
Comment #4
johnvComment #5
alan d. commentedI've committed through these additions. The value field is the ISO2 code. The safe_value parameter is just like the safe parameter, the country name passed through check_plain().
The code was updated to use the safe_value field and I expect the safe parameter to be removed in a few tags time.