diff --git sites/all/modules/contrib/views/modules/taxonomy.views.inc sites/all/modules/contrib/views/modules/taxonomy.views.inc index ff1cb6b..f1a90f3 100644 --- sites/all/modules/contrib/views/modules/taxonomy.views.inc +++ sites/all/modules/contrib/views/modules/taxonomy.views.inc @@ -464,6 +464,12 @@ function taxonomy_views_plugins() { 'path' => drupal_get_path('module', 'views') . '/modules/taxonomy', 'parent' => 'fixed', ), + 'taxonomy_tid_node' => array( + 'title' => t('Taxonomy Term ID from current node goobaloo'), + 'handler' => 'views_plugin_argument_default_taxonomy_tid_node', + 'path' => drupal_get_path('module', 'views') . '/modules/taxonomy', + 'parent' => 'taxonomy_tid', + ), ), ); } diff --git sites/all/modules/contrib/views/modules/taxonomy/views_plugin_argument_default_taxonomy_tid_node.inc sites/all/modules/contrib/views/modules/taxonomy/views_plugin_argument_default_taxonomy_tid_node.inc new file mode 100644 index 0000000..926ceee --- /dev/null +++ sites/all/modules/contrib/views/modules/taxonomy/views_plugin_argument_default_taxonomy_tid_node.inc @@ -0,0 +1,39 @@ +argument->options['validate_type'] == 'taxonomy_term') { + $valid_vids = $this->argument->options['validate_argument_vocabulary']; + foreach ($node->taxonomy as $tid => $term) { + // This has VID => VID for selected ones, and VID => 0 otherwise. + if ($valid_vids[$term->vid]) { + $tids[] = $tid; + } + } + } + // Otherwise, take all terms from the node. + else { + $tids = array_keys($node->taxonomy); + } + + if ($tids) { + // Transform the argument to a string of comma-separated tids. + return implode(',', $tids); + } + } + // Views will just do nothing for this argument if we end up here. + } +}