function ds_get_content in Display Suite 6.2
Helper function to get content for a field
Parameters
stdClass $item: the item to set content for
array $content_vars (optional): the $vars array, or an array containing possible values
string $vars_key: the key within $content_vars to retrieve
Return value
the content value as a string, or FALSE if none was found
3 calls to ds_get_content()
- ds_render_content in ./
ds.module - Render content for an object.
- ds_render_group in ./
ds.module - Return a rendered fieldset group.
- ds_render_multigroup in ./
ds.module - Return a rendered multigroup group.
File
- ./
ds.module, line 1030 - Core functions for the Display Suite module.
Code
function ds_get_content($item, $content_vars = array(), $vars_key = NULL) {
if (!is_array($item)) {
return FALSE;
}
$content = '';
// If content has been prerendered by ds_build_fields_and_objects use that
if (!empty($item['content'])) {
$content = $item['content'];
}
elseif (!empty($content_vars)) {
// CCK fields will use $vars_key.'_rendered'
// @todo: this is a bit of a hacky way to get CCK content, refactor
if (isset($content_vars[$vars_key . '_rendered'])) {
$content = $content_vars[$vars_key . '_rendered'];
}
elseif (isset($content_vars[$vars_key])) {
$content = $content_vars[$vars_key];
}
}
if (!empty($content)) {
return $content;
}
return FALSE;
}