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.

Comments

yi_jiang created an issue. See original summary.

yi_jiang’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha4
yi_jiang’s picture

StatusFileSize
new549 bytes
socialnicheguru’s picture

WSOD 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).

socialnicheguru’s picture

Status: Needs review » Needs work
joshua.roberson’s picture

Status: Needs work » Needs review
StatusFileSize
new490 bytes

The 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.

flashwebcenter’s picture

StatusFileSize
new492 bytes

I 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.

joshua.roberson’s picture

Status: Needs review » Reviewed & tested by the community

#7 is the same patch except applied to the alpha branch. It works fine for me.

joseph.olstad’s picture

Version: 8.x-1.0-alpha4 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
Related issues: +#3053031: Change views filter to use similar filter to index tid.

there 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.

flashwebcenter’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new121.78 KB
new75.11 KB
new56.38 KB
new66.29 KB

Hello,
I just tested the latest release

Development version: 8.x-1.x-dev updated 6 Jun 2019 at 13:43 UTC

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)


vocabulary


2- Create a view page and add anything inside it.


Full page


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:


vocabulary


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.


vocabulary


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.

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: Exception in test[test]: SQLSTATE[42S22]: Column not found: 1054 Unknown column &#039;node_field_data.term_node_tid_depth&#039; in &#039;IN/ALL/ANY subquery&#039;: SELECT node_field_data.created AS node_field_data_created, node_field_data.nid AS nid
FROM
{node_field_data} node_field_data
WHERE (node_field_data.term_node_tid_depth IN (SELECT tn.nid AS nid
FROM
{taxonomy_index} tn
LEFT OUTER JOIN {taxonomy_term__parent} th ON th.entity_id = tn.tid
LEFT OUTER JOIN {taxonomy_term__parent} th1 ON th.parent_target_id = th1.entity_id
LEFT OUTER JOIN {taxonomy_term__parent} th2 ON th1.parent_target_id = th2.entity_id
WHERE (tn.tid = :db_condition_placeholder_0) OR (th1.entity_id = :db_condition_placeholder_1) OR (th2.entity_id = :db_condition_placeholder_2))) AND (node_field_data.status = :db_condition_placeholder_3)
ORDER BY node_field_data_created DESC
LIMIT 11 OFFSET 0; Array
(
    [:db_condition_placeholder_0] =&gt; 1028
    [:db_condition_placeholder_1] =&gt; 1028
    [:db_condition_placeholder_2] =&gt; 1028
    [:db_condition_placeholder_3] =&gt; 1
)
 in <em class="placeholder">Drupal\views\Plugin\views\query\Sql-&gt;execute()</em> (line <em class="placeholder">1543</em> of <em class="placeholder">core/modules/views/src/Plugin/views/query/Sql.php</em>). <pre class="backtrace">Drupal\views\ViewExecutable-&gt;execute(NULL) (Line: 1454)
Drupal\views\ViewExecutable-&gt;render() (Line: 183)
Drupal\views\Plugin\views\display\Page-&gt;execute() (Line: 1630)
Drupal\views\ViewExecutable-&gt;executeDisplay(&#039;page_1&#039;, Array) (Line: 77)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func(Array, Array) (Line: 378)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, &#039;kernel.view&#039;, Object)
call_user_func(Array, Object, &#039;kernel.view&#039;, Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(&#039;kernel.view&#039;, Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

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.

joseph.olstad’s picture

Status: Needs review » Fixed

Thanks for the detailed explanation, ok tagging another release with patch 7 included.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.