Skip to content

Instantly share code, notes, and snippets.

@thelebster
Created April 8, 2014 02:39
Show Gist options
  • Save thelebster/10084652 to your computer and use it in GitHub Desktop.
Save thelebster/10084652 to your computer and use it in GitHub Desktop.
#drupal #views
/**
* Implements hook_views_default_views_alter()
*
* $handler =& $view->display['DISPLAY_ID']->handler;
*/
function MODULENAME_views_default_views_alter(&$views) {
if (isset($views['admin_views_node'])) {
$handler =& $views['admin_views_node']->display['default']->handler;
// add Filter criterion: Taxonomy term: Term
$handler->display->display_options['filters']['tid_1']['id'] = 'tid_1';
$handler->display->display_options['filters']['tid_1']['table'] = 'taxonomy_term_data';
$handler->display->display_options['filters']['tid_1']['field'] = 'tid';
$handler->display->display_options['filters']['tid_1']['relationship'] = 'term_node_tid';
$handler->display->display_options['filters']['tid_1']['exposed'] = TRUE;
$handler->display->display_options['filters']['tid_1']['expose']['operator_id'] = 'tid_1_op';
$handler->display->display_options['filters']['tid_1']['expose']['label'] = 'Term (Content Categories)';
$handler->display->display_options['filters']['tid_1']['expose']['operator'] = 'tid_1_op';
$handler->display->display_options['filters']['tid_1']['expose']['identifier'] = 'tid_1';
$handler->display->display_options['filters']['tid_1']['expose']['multiple'] = TRUE;
$handler->display->display_options['filters']['tid_1']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
4 => 0,
3 => 0,
5 => 0,
6 => 0,
);
$handler->display->display_options['filters']['tid_1']['type'] = 'select';
$handler->display->display_options['filters']['tid_1']['vocabulary'] = 'content_categories';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment