function hook_views_json_render_row_alter in Views Datasource 7
Alter rendered json row.
Parameters
$field_output array: The output rendered by _views_json_render_fields().
$view view: The view that is being rendered.
$row stdClass: Raw data collected by views_plugin_json_style().
See also
views_plugin_json_style().
1 invocation of hook_views_json_render_row_alter()
- views_plugin_style_json::render in views/
plugins/ views_plugin_style_json.inc - Implementation of view_style_plugin::render()
File
- ./
views_json.api.php, line 21 - Describe hooks provided by the Views datasource module.
Code
function hook_views_json_render_row_alter(&$field_output, $view, $row) {
if (isset($row->field_entity_reference[0]['raw']['entity'])) {
$entity = $row->field_entity_reference[0]['raw']['entity'];
$field_output['field_entity_reference']->content = array(
'type' => $entity->type,
'title' => $entity->title,
'entity_id' => $entity->entity_id,
);
}
// Note that the $field_output array is not returned – it is modified by
// reference.
}