Problem/Motivation
Create a view, such as nodes associated with a group or taxonomy term, and add validation on the bundle, as well as a local task.
On entities with a different bundle, the local task still shows up even though the view itself with be a 404 or 403 depending on the argument configuration. This is because argument validation isn't taken into account for view access.
Proposed resolution
Consider adding support for #2858776: Make defining bundle-specific routes easier as a view access handler, so that the route can be made bundle-specific too.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #10
aleixWhile not there, here it is a workaround: https://peacocksoftware.com/blog/drupal-89-views-tab-only-certain-node-t...
Comment #11
aleixLooking a little more on how can I do it, I was trying to get the same behavior as in drupal 7 where the tab is shown depending on how the validation is done in argument contextual filter( similar as what happens in https://www.drupal.org/project/views/issues/2345763 ).
The workaround in previous comment is too specific and customized for a specific route. A more generic way of doing, could be what is done in this experimental module: https://gitlab.com/communia/views_validate_tabs . It adds a new access plugin extending permission but using the validator defined in contextual filter.
Comment #12
scotwith1tNice one, thanks for the custom module. Simple enough and certainly contrib-worthy until this is addressed in core. In our case, the Event node type has a tab for admins to see registrations, which of course don't apply to other content types. Thanks again, @aleix.
Comment #13
catchDuplicate of #2778345: Views argument validators aren't taken into account on access checks - local task point to 404