Problem/Motivation
There is currently no way to get raw values from custom fields in the preprocess functions for advanced theming.
Proposed resolution
For custom_field theme function:
Add the following:
#object (the entity object)
#entity_type
#bundle,
#language
#raw_value (the raw field value)
For custom_field_item theme function:
Add: the following:
#entity_type
#bundle,
#language
#raw_value (the raw subfield value including extra columns if applicable)
Note: The #raw_value for custom_field_item can be either a scalar or an array depending on whether the subfield type has extra columns.
Issue fork custom_field-3614736
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
apmsooner commentedComment #4
apmsooner commentedComment #5
apmsooner commentedComment #6
apmsooner commentedComment #7
scottsawyer@apmsooner
This looks great to me. I see all the keys under $variables['elements'] when preprocessing the field, which is fantastic as it will save at least 1 entity load per field instance in my case.
Oh, I could only test on 5.0.x.
Comment #9
apmsooner commented