Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.phpundefined
@@ -34,6 +37,69 @@ protected function defineOptions() {
+ // @todo How do we apply argument validation?
+ $bits = explode('/', $this->getOption('path'));
+ // @todo Figure out validation/argument loading.
+ // Replace % with %views_arg for menu autoloading and add to the
+ // page arguments so the argument actually comes through.
+ $arg_counter = 0;
Comments
Comment #1
almaudoh CreditAttribution: almaudoh commentedI tried setting path "user/%/my-messages" and the menu option "Menu tab" and the parent page blew up with exception.
I also set the contextual filter to "the user id". What should be the correct behavior here?
Comment #2
james.williams CreditAttribution: james.williams at ComputerMinds commentedChange the path of your view to user/%user/my-messages and it should work. This is far from obvious, and I would argue represents a bug, since users that create views that are Menu tabs are required to know the appropriate named placeholder of the existing route that their view is being added as a local task of.
Comment #7
gauravjeet CreditAttribution: gauravjeet as a volunteer and at Acro Commerce commented+1 for #2
Comment #8
johnhuang0808 CreditAttribution: johnhuang0808 at Fliegen commentedI also encountered the issue and the comment #2003866-2: Invent argument validation in the router entries works for me. If the path of the views is user/%/my-messages, in router database table, the path is user/{arg_0}/my-messages instead of user/{user}/my-messages. The former is regarded the '%' as a view argument and the later is regarded as an user object.
The path is generated from Drupal\views\Plugin\views\display\PathPluginBase. The following snippet looks like processing it:
Comment #14
catchIs this the same as #2778345: Views argument validators aren't taken into account on access checks - local task point to 404?
Comment #15
LendudeNice find @catch, closing this as a duplicate of #2778345: Views argument validators aren't taken into account on access checks - local task point to 404
Later comments are focussed on paths using only a '%' and not adding an entity type, which are failing, for that we have #2489940: Views path with menu tab does not validate and results in fatal error
If somebody feels this is addressing a different issue, please feel free to re-open this.