Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Consider this generic approach of rendering fields:
$wrapper = entity_metadata_wrapper($entity_type, $entity);
foreach ($fields as $field_name => $field) {
$data = '';
if ($field['type'] == 'property') {
$property = $wrapper->{$field_name};
$data = $property->value();
}
elseif ($field['type'] == 'field' && isset($entity->{$field_name})) {
...
$renderable_data = field_view_field($entity_type, $entity, $field_name, $display);
...
$data = drupal_render($renderable_data);
}
$build[] = $data;
}
...
return theme('ahook', array('data' => $build));
Now how to modify the code to add DS fields to the output?
Comments
Comment #1
OnkelTem CreditAttribution: OnkelTem commentedComment #2
aspilicious CreditAttribution: aspilicious commentedThis will never work as display suite depends on the view mode settings which you're not passing .
If you still want to try this you should look the the alter function that builds the layout "ds_field_attach_view_alter" in ds.module
Enough information?
Comment #3
OnkelTem CreditAttribution: OnkelTem commentedOk, I see. Thank you.