diff --git a/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term_machine_name.inc b/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term_machine_name.inc index dd277e6ef26c5ea290d439e6b709230a3ce5e6e9..6988e7dff7e7489d5e31e4e4559721005ca1702a 100644 --- a/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term_machine_name.inc +++ b/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term_machine_name.inc @@ -16,6 +16,10 @@ class views_plugin_argument_validate_taxonomy_term_machine_name extends views_pl // Add new validator. $form['type']['#options']['machine_name'] = t('Term machine name'); + + // When using machine names, it doesn't make sense to transform to spaces. + // Transform to underscores instead. + $form['transform']['#title'] = t('Transform dashes in URL to underscores in term machine name filter values'); } function validate_argument($argument) { @@ -33,7 +37,7 @@ class views_plugin_argument_validate_taxonomy_term_machine_name extends views_pl $query->condition('tv.machine_name', $vocabularies); } if ($transform) { - $query->where("replace(td.machine_name, ' ', '-') = :name", array(':name' => $argument)); + $query->where("replace(td.machine_name, '_', '-') = :name", array(':name' => $argument)); } else { $query->condition('td.machine_name', $argument); @@ -41,8 +45,8 @@ class views_plugin_argument_validate_taxonomy_term_machine_name extends views_pl $term = $query->execute()->fetchObject(); if ($term && (empty($vocabularies) || !empty($vocabularies[$term->machine_name]))) { - if ($type == 'convert') { - $this->argument->argument = $term->tid; + if ($transform) { + $this->argument->argument = str_replace('-', '_', $argument); } $term = taxonomy_term_load($term->tid); $this->argument->validated_title = check_plain(entity_label('taxonomy_term', $term));