Skip to content

Instantly share code, notes, and snippets.

@gagarine
Created August 17, 2011 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gagarine/1152064 to your computer and use it in GitHub Desktop.
Save gagarine/1152064 to your computer and use it in GitHub Desktop.
<?php
function hook_views_pre_render(&$view) {
if ($view->name == 'ranges_by_room') {
//we order the view by node_node_data_field_pim_offer_title
//and we want the offer information only one time
$preview_offer = FALSE;
foreach ($view->result as $key => $value) {
if ($preview_offer == $view->result[$key]->node_node_data_field_pim_offer_nid) {
unset($view->result[$key]->node_node_data_field_pim_offer_node_data_field_pim_description_field_pim_description_value);
unset($view->result[$key]->node_node_data_field_pim_offer_node_data_field_pim_image_field_pim_image_value);
}
else {
$preview_offer = $view->result[$key]->node_node_data_field_pim_offer_nid;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment