Closed (works as designed)
Project:
Display Suite
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 May 2013 at 14:06 UTC
Updated:
2 Jun 2013 at 08:18 UTC
Hi,
I tried to create a display suite field of the function type.
Unfortunately it didn't work for me.
After some research I found that the ds_get_field_value() function tries
to access $field['function'] which was not set by the ds_ds_fields_info()
function:
$fields[$entity_type][$key] = array(
'title' => $field->label,
'field_type' => $field->field_type,
'properties' => $field->properties,
);
So there might be two possible solutions:
1) Move the function attribute into the properties array:
$field['properties']['function']
2) Change ds_ds_fields_info to copy the file and function properties:
$fields[$entity_type][$key] = array(
'title' => $field->label,
'field_type' => $field->field_type,
'properties' => $field->properties,
'function' => $field->function,
'file' => $field->file,
);
I guess the first approach is cleaner as there is already a properties array.
| Comment | File | Size | Author |
|---|---|---|---|
| ds_function_type.patch | 1.54 KB | jantimon |
Comments
Comment #1
swentel commentedThis works perfectly, a lot of fields use it already http://drupalcode.org/project/ds.git/blob/refs/heads/7.x-2.x:/ds.ds_fiel...
So I'm not sure what's going on here.
Comment #2
jantimon commentedHey,
sorry I guess it was my bad. I used
hook_ds_custom_fields_infoinstead ofhook_ds_fields_info.With
hook_ds_fields_infoit works as intended.Thanks for your support.
Comment #3
swentel commented