diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-11-16 18:27:48 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-11-16 18:27:48 -0200 |
commit | 2c514ad914d211b4ca251aee9a3982901bcd4ee7 (patch) | |
tree | f0260d344f0590c54eababdd8386df574cd4920a | |
parent | 8ae3a00a11d55c31de37b35cf6855fd333b0a29a (diff) | |
download | muamba-2c514ad914d211b4ca251aee9a3982901bcd4ee7.tar.gz muamba-2c514ad914d211b4ca251aee9a3982901bcd4ee7.tar.bz2 |
Filter out unavailable items from 'disponiveis' views
-rw-r--r-- | muamba.module | 14 |
1 files changed, 14 insertions, 0 deletions
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]); + } + } + } +} |