From 2c514ad914d211b4ca251aee9a3982901bcd4ee7 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 16 Nov 2011 18:27:48 -0200 Subject: Filter out unavailable items from 'disponiveis' views --- muamba.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/muamba.module b/muamba.module index f951210..b35949d 100644 --- a/muamba.module +++ b/muamba.module @@ -334,3 +334,17 @@ function muamba_form_alter(&$form, &$form_state, $form_id) { unset($form['flag']); } } + +/** + * Implements hook_views_pre_render() + */ +function muamba_views_pre_render(&$view) { + // Filter out unavailable items from view. + if ($view->name == 'muambas' && substr($view->current_display, 0, 11) == 'disponiveis') { + foreach ($view->result as $key => $result) { + if (!muamba_check_availability($result->nid)) { + unset($view->result[$key]); + } + } + } +} -- cgit v1.2.3