function viewfield_default_elements_post_render in Viewfield 7.3
Same name and namespace in other branches
- 7.2 viewfield.module \viewfield_default_elements_post_render()
#post_render callback for viewfield default formatter.
1 string reference to 'viewfield_default_elements_post_render'
- viewfield_field_formatter_view in ./
viewfield.module - Implements hook_field_formatter_view().
File
- ./
viewfield.module, line 324 - Defines a field type to display a view.
Code
function viewfield_default_elements_post_render($content, $element) {
// Set the default state to empty.
$empty = TRUE;
// Retrieve all element children.
$children = array_intersect_key($element, element_children($element));
foreach ($children as $key => $child) {
$view = $child['#view'];
// If any child view has results, output the field.
if (!empty($view->result) || !empty($view->empty)) {
$empty = FALSE;
}
}
return $empty === FALSE ? $content : NULL;
}