This is a request for a core function which does something like this:
show_value_field($field_name, $entity, $value_set, $amount, $display_type, $value_type)
Where:
$field_name = the field name | Required
$entity = entity type (multiple values allowed) | Optional (defaults to show all)
$value_set = set values (1), non set values (2), all values (3) | Optional (defaults to 1)
$amount = show single value (1), specify number of values (2), all values (3) | Optional (defaults to 1)
$display_type = use a (custom) field.tpl.php (1), use plain value (2) | Optional (defaults to 1)
$value_type = plain text (1), int (2), url (3), img (4), etc(?) | Optional (defaults to 1)
I have searched the interwebs, as well as the fields issue cue. Could not find a similar solution or issue in the cue, but may have overlooked something of course. I feel this function could enhance interaction with fields. I would really like to keep the function simple on the user end, to keep it easy for entry level people to use while powerful enough to use in most use cases.
What do other people think?
Comments
Comment #0.0
Anonymous (not verified) commentedRevised
Comment #0.1
Anonymous (not verified) commentedRevised text
Comment #0.2
Anonymous (not verified) commentedRevised text
Comment #0.3
Anonymous (not verified) commentedRevised text
Comment #0.4
Anonymous (not verified) commentedRevised text
Comment #0.5
Anonymous (not verified) commentedRevised text
Comment #0.6
Anonymous (not verified) commentedRevised text
Comment #0.7
Anonymous (not verified) commentedRevised text
Comment #0.8
Anonymous (not verified) commentedText revision
Comment #0.9
Anonymous (not verified) commentedRewrote function
Comment #1
swentel commentedComment #2
effulgentsia commentedCan you give some example use cases of calling this function for different field types with different values for each of the parameters? Also, who do you envision as the primary audience for this function (someone editing a template, someone writing a preprocess function, someone else)?
Comment #3
Anonymous (not verified) commentedPrimary adience:
At a theme level, but when I think about your question. I see it could possibly come in handy for some modules as well.
Example cases:
1. I want to print the plain text of a field value, to further process this, for example make sure all the first letters are capitalized, or to transform the value e.g. date notation.
2. I want a dynamic call in the theme where I load the url of a picture, and an img tag with custom markup, while filling the title with info from a different field.
3. I have multipe values in a field, and want to show them easily, as a menu with links.
4. I want to quickly add or change a field.tpl.php for a field.
5. I want to use the field for conditional statements, based on multiple values, to make a choice whether to show a block or view in a template.
Basically, I want the feeling that if I have field, I can do everything that I run into on a regular basis, without having to worry about a bunch of complicated code in template.php.
Hope I have been able to clarify a bit more. Please feel free to post further comments or suggestions on this.
Comment #3.0
Anonymous (not verified) commentedText revision
Comment #10
ghost of drupal past