Drupal views: upcoming events per Organic Group

Je wilt de komende evenementen van een bepaalde groep in een blok tonen op je Drupal website?
En je hebt al uren liggen knoeien met de instellingen?
Probleem opgelost! Importeer volgende code bij je views et voila…
Vergeet zeker je views cache niet te legen wanneer het “now” keyword niet wil werken 😉

$view = new view;
$view->name = 'og_event';
$view->description = 'Volgende keer block';
$view->tag = 'volgende keer';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_datum_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => TRUE,
),
'repeat' => array(
'show_repeat_rule' => '',
),
'fromto' => array(
'fromto' => 'value',
),
'exclude' => 0,
'id' => 'field_datum_value',
'table' => 'node_data_field_datum',
'field' => 'field_datum_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 1,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('sorts', array(
'field_datum_value' => array(
'id' => 'field_datum_value',
'table' => 'node_data_field_datum',
'field' => 'field_datum_value',
),
));
$handler->override_option('arguments', array(
'group_nid' => array(
'id' => 'group_nid',
'table' => 'og_ancestry',
'field' => 'group_nid',
),
'date_argument' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'Alle',
'title' => '',
'default_argument_type' => 'date',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'date_fields' => array(
'node_data_field_datum.field_datum_value' => 'node_data_field_datum.field_datum_value',
'node_data_field_toeterdate.field_toeterdate_value' => 'node_data_field_toeterdate.field_toeterdate_value',
),
'year_range' => '-3:+3',
'date_method' => 'OR',
'granularity' => 'month',
'id' => 'date_argument',
'table' => 'node',
'field' => 'date_argument',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'poll' => 0,
'faq' => 0,
'event' => 0,
'event2' => 0,
'event3' => 0,
'group' => 0,
'page' => 0,
'startpagina' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'user_argument_type' => '',
'restrict_user_roles' => 0,
'user_roles' => array(),
'validate_argument_is_member' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('title', 'Volgende keer');
$handler->override_option('footer', '<br />');
$handler->override_option('footer_format', '2');
$handler->override_option('footer_empty', 0);
$handler->override_option('empty', 'Geen vergaderingen gevonden.');
$handler->override_option('empty_format', '2');
$handler->override_option('items_per_page', 1);
$handler->override_option('use_more', 1);
$handler = $view->new_display('block', 'Blok', 'block_1');
$handler->override_option('filters', array(
'picg' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'picg',
'table' => 'og_ancestry',
'field' => 'picg',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'date_filter' => array(
'operator' => '>=',
'value' => array(
'value' => '2009-03-14 00:00:00',
'min' => NULL,
'max' => NULL,
'default_date' => 'now',
'default_to_date' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'date_fields' => array(
'node_data_field_datum.field_datum_value' => 'node_data_field_datum.field_datum_value',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => 'now',
'default_to_date' => '',
'year_range' => '-3:+3',
'id' => 'date_filter',
'table' => 'node',
'field' => 'date_filter',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.