diff --git a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc b/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc index f492a9a..5fd97d0 100644 --- a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc +++ b/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc @@ -31,7 +31,7 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d ); $form[$this->option_name . '_node'] = array( '#type' => 'checkbox', - '#title' => t('Load default argument from node page, thats good for related taxonomy blocks'), + '#title' => t('Load default argument from node page (good for related taxonomy blocks)'), '#default_value' => $this->argument->options[$this->option_name . '_node'], '#process' => array('views_process_dependency'), '#dependency' => array( @@ -41,6 +41,23 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d '#dependency_count' => 2, ); + $form[$this->option_name . '_operator'] = array( + '#type' => 'select', + '#title' => t('How to combine term IDs'), + '#description' => t("Whether to form multiple term IDs into the argument with '+' or ','."), + '#options' => array( + 'and' => 'and', + 'or' => 'or', + ), + '#process' => array('views_process_dependency'), + '#dependency' => array( + 'radio:options[default_action]' => array('default'), + 'radio:options[default_argument_type]' => array($this->id), + 'edit-options-default-taxonomy-tid-node' => array(1), + ), + '#dependency_count' => 3, + ); + $form[$this->option_name . '_limit'] = array( '#type' => 'checkbox', '#title' => t('Limit terms by vocabulary'), @@ -104,12 +121,23 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d $tids[] = $tid; } } - return implode(",", $tids); } // Return all tids. else { - return implode(",", array_keys($node->taxonomy)); + $tids = array_keys($node->taxonomy); + } + + // The argument is transformed to a string of tids, in the form + // of 1+2+3 (for OR) or 1,2,3 (for AND). + if ($this->argument->options[$this->option_name] == 'and') { + $glue = ','; } + else { + $glue = '+'; + } + + $argument_value = implode($glue, $tids); + return $argument_value; } }