function ds_get_field_value in Display Suite 7.2
Same name and namespace in other branches
- 7 ds.module \ds_get_field_value()
Get the value for a Display Suite field.
Parameters
$key: The key of the field.
$field: The configuration of a DS field.
$entity: The current entity.
$entity_type: The name of the entity.
$bundle: The name of the bundle.
$view_mode: The name of the view mode.
$build: The current built of the entity.
Return value
$markup The markup of the field used for output.
1 call to ds_get_field_value()
- ds_field_attach_view_alter in ./
ds.module - Implements hook_field_attach_view_alter().
File
- ./
ds.module, line 421 - Display Suite core functions.
Code
function ds_get_field_value($key, $field, $entity, $entity_type, $bundle, $view_mode, $build = array()) {
$field['field_name'] = $key;
$field['entity'] = $entity;
$field['entity_type'] = $entity_type;
$field['bundle'] = $bundle;
$field['view_mode'] = $view_mode;
$field['build'] = $build;
// Special case for ds_views which can handle custom fields now.
if ($field['field_type'] != DS_FIELD_TYPE_PREPROCESS && $entity_type == 'ds_views') {
$entity->preprocess_fields[] = $key;
}
switch ($field['field_type']) {
case DS_FIELD_TYPE_PREPROCESS:
$entity->preprocess_fields[] = $key;
break;
case DS_FIELD_TYPE_FUNCTION:
if (isset($field['file'])) {
include_once $field['file'];
}
return $field['function']($field);
case DS_FIELD_TYPE_THEME:
$format = isset($field['formatter']) ? $field['formatter'] : key($field['properties']['formatters']);
return theme($format, $field);
case DS_FIELD_TYPE_CODE:
return ds_render_code_field($field);
case DS_FIELD_TYPE_CTOOLS:
return ds_render_ctools_field($field);
case DS_FIELD_TYPE_BLOCK:
return ds_render_block_field($field);
}
}