line 93 in TermMachineName class
$this->argument->realField = 'tid';
It causes a huge pain for us since we created a custom media type.
I have replaced tid to this:
$this->argument->realField = $this->argument->field;
It works fine.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | term-with-depth.png | 66.29 KB | flashwebcenter |
| #10 | tax-terms.png | 56.38 KB | flashwebcenter |
| #10 | contexutal-filter-settings.png | 75.11 KB | flashwebcenter |
| #10 | full-view-page.png | 121.78 KB | flashwebcenter |
| #7 | taxonomy_machine_name_remove-hardcoded-tid2948227-7.patch | 492 bytes | flashwebcenter |
Comments
Comment #2
yi_jiang commentedComment #3
yi_jiang commentedComment #4
socialnicheguru commentedWSOD on views page:
https://mysite.com/admin/structure/views/view/group_events?destination=/...|1||Drupal\Component\Plugin\Exception\PluginException: Plugin (taxonomy_term_machine_name) instance class "Drupal\taxonomy_machine_name\Plugin\views\argument_validator\TermMachineName" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of drupal-8.5.1/html/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
Comment #5
socialnicheguru commentedComment #6
joshua.roberson commentedThe patch from #3 doesn't work for me either.
The fix is this:
The "realField" value is being changed from "nid" to "tid" unnecessarily. The "node_field_data" table doesn't have a "tid" column, but a "nid" column. The fix is to remove the line that changes it.
Comment #7
flashwebcenterI tried to apply the patch https://www.drupal.org/patch/apply (patch -p1 < path/file.patch) I could not get it to apply. I applied the patch manually and test it. It fix the using taxonomy name machine as contextual filter.
When you try to use the taxonomy term machine as a contextual filter in views you get an error. By applying this patch you will be able to use taxonomy term machine instead of taxonomy term Id in the url.
I recreated the patch and test it on '8.x-1.0-alpha4' it will be applied without any problem.
Comment #8
joshua.roberson commented#7 is the same patch except applied to the alpha branch. It works fine for me.
Comment #9
joseph.olstadthere is a different approach in #3053031: Change views filter to use similar filter to index tid.
that uses a dropdown
going with that for now, marking this as postponed until people can provide feedback on beta2 release.
Comment #10
flashwebcenterHello,
I just tested the latest release
and I got the error back.




Here is how to test for the issue.
1- Create a vocabulary name Fruit and add two terms inside it. (Lemon & Oranges)
2- Create a view page and add anything inside it.
3- Pass an argument in the url page /test/%
4- Under Contextual filter and add Has Taxonomy Term ID with depth and setting should be as:
WHEN THE FILTER VALUE IS NOT IN THE URL
Select "page not found".
WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED
- check Specify validation criteria.
- From Validator drop down list choose Taxonomy term machine name.
- Select Fruit vocabulary
- Apply your changes and save the view.
Visit the view page and add the argument in the url yoursitedotcom/test/lemon or yoursitedotcom/test/oranges
Here is the error when you view the page.
If you remove
$this->argument->realField = 'tid';in taxonomy_machine_name >> src >> Plugin >> views >> argument_validator >> TermMachineName.php line 97, you will be able to view the page without the error.Comment #12
joseph.olstadThanks for the detailed explanation, ok tagging another release with patch 7 included.