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.
Hi,
I'm trying to show a (second) views-page when clicking a megarow-link. This second views-page depends on arguments passed by the url (contexual filter). But I'm not sure how to make it all happen.
When setting up the megarow-link, it's actual path becomes: /display_megarow/[argument]/[url]
This means the (second) views-page url should be like: %/[url]
But views doesn't accept an argument in the first segment of the path.
Any help would be very much appreciated.
Thanks,
Mike.
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedIn Commerce Backoffice (Product submodule) we do it by implementing a page callback that is shown in the megarow, and then in that page callback calling views_embed_view and passing the arguments manually.
Comment #2
sportel CreditAttribution: sportel commentedThanks for your quick repsonse. I'm afraid that diving in to the code (and understanding it) is beyond my skills. So I'll keep looking for another solution.
Mike.
Comment #3
sportel CreditAttribution: sportel commentedI probably can get it to work by changing the code part where the URL is build, making it show the entity_id after the given link-part. But I'm sure that will distroy more than it will accomplish. So maybe I should make it a feature request:
Give users the option in the UI to choose where the entity_id is put in the URL, so it can be used as an argument.
I hope this makes sense.
Mike.
Comment #4
sportel CreditAttribution: sportel commentedComment #5
ArtusamakThis is not planned for the scope of the module for now so i'm afraid that you will have to write some code in order to do it!
Good luck. ;)
Comment #7
heyddi CreditAttribution: heyddi commentedHere is how I managed to do it:
In the first view (the one with the megarow link, the node ID is the argument I want to use for the other view. I set the path of the link to /something/[node:id].
In the second view, I set the path to something/% and set the argument to use the Content ID in the URL.
So now, clicking on the megarow link gives a link like this: /display_megarow/[argument]/something/[argument] so there is "double" argument.
Simple, but it seems to do the job.
Hope this helps