I tried to search for a solution or question to this but couldnt fin anything, so sorry if its a duplicate.
Basically I have a panel page (custom) in which i used the content id argument. node/%node/custom. When I use distance / proximity filtering in a view and select "Entity from URL" it is not picking up the arguments and displaying the nodes closest to that page when attached to the panel.
If i put the same view in the original node ie. node/%, it works fine, but when I use a custom panel OR even a custom page view with a custom path ie. node/%/custom, it doesn't. It only works if the view is attached to the actual node (node/%). Pretty much all of my other views work, my titles carry over, and drupal as a whole knows that these custom views / panel pages have a context of the relevant NID, but proximity filtering doesn't. I am guessing this is because there is no contextual filter setup and proximity filtering works off its own algorithm which is ignoring any sub / custom pages that carry the same nid in the url ie(node/%/whatever).
It seems proximity filtering ONLY looks at the actual node, not any context pages (either from views or panels) based off that node. Does anybody know how I can get proximity filtering using Entity from URL working with any subpages of that node? Perhaps a work around?
I really need this functionality and wasted more than 3 days trying 100 different ways to get this to work, to no avail. Ideally I think the "Entity from URL" feature should look at any page with the context of the nid (as most views, blocks, and modules do), not only at the root node - it should work almost like a contextual filter.
Comment | File | Size | Author |
---|---|---|---|
#2 | proximity.png | 140.71 KB | Brandonian |
Comments
Comment #0.0
Exploratus CreditAttribution: Exploratus commentedMade it a tad more detailed.
Comment #1
Exploratus CreditAttribution: Exploratus commentedBump. :)
Comment #2
Brandonian CreditAttribution: Brandonian commented@Exploratus, I've been able to successfully create a view with proximity filtering set up and firing correctly as a panel pane, but I may not be hitting your exact use case. Attached is an image that shows my current setup.
One caveat for the proximity filters/contextual arguments is that we use menu_get_object() instead of pulling directly from the views argument object. This is probably the source of your issue, however I'm confused as the situation where you would have a node load correctly at node/%/custom and have menu_get_object not load the entity id properly. Is the node in the url the one you want to reference for a proximity search, or is it a node referenced in one of your panes somehow?
Comment #3
Exploratus CreditAttribution: Exploratus commentedHi Brandonian.
Basically if I have:
node/example
and load a view with proximity filtering, everything works perfectly in a panel pane.
if i create a custom panel page with a context so its:
node/example/largemap
The proximity filter no longer picks up the current node as the reference node to filter items in proximity to it.
I know the context works, other view work perfectly, the only view that doesnt work is the one using the proximity filter, because the filter does not recognize the context page.
I have a view that centers on the current node and that works perfectly, as it grabs its context from the contextual filter. Both on node/example, and node/example/largemap, it works perfectly.
Nevertheles, my other view using proximity only works on node/example. The field options where I select "Source of Origin Point" doesnt seem to pick up the context page argument. node/example/largemap doesnt recognize that its the same as node/example in terms of context.
To test, create a custom panel page and pass the Node ID context to it. (node/%/whatever) Create a view with a contextual filter to current node. It will work fine. Now do the same but using proximity filtering and pick the current node for "Source of Origin Point". It wont work. Same thing happens if you do a view page, it doesn't have anything to do with panels. IMHO its definitely something with the filter, I just dont know enough PHP to figure it out.
Comment #4
fonant CreditAttribution: fonant commentedI have this problem too.
If I create a Views page, with a URL of
node/%/nearby
and as a menu tab, the "Entity from URL" results in all the proximities being zero. If I create a block as well, the "Entity from URL" works fine on the main node View pagenode/%
, but it also fails on the nearby tab with the URLnode/%/nearby
.It does look as though
menu_get_object()
should return the node fromnode/%/nearby
, but in fact it doesn't.menu_get_object()
doesn't work for the Views-generated sub-path ofnode/%/nearby
.menu_get_object('node', 1)
doesn't work.menu_get_object('node', 1, 'node/%/nearby')
doesn't work.menu_get_object('node', 1, 'node/%/notavalidpath')
works nicely!The problem is that
menu_get_object()
is using the menu router table, which works for all defined node URLs likenode/%
and also for any URLs of the formnode/%/something-else
that aren't being handled by another router item. In these casesmenu_get_item()
returnsArray ( [path] => node/% [load_functions] => Array ( [1] => node_load ) ... )
But in my case Views has added a menu router entry for
node/%/nearby
andmenu_get_item()
returns:so
menu_get_object()
does nothing because it requires theload_function
to be "node_load" by default.Result: menu_get_object() works on the node page, but not on the View-generated page with a sub-path.
Comment #5
Exploratus CreditAttribution: Exploratus commentedGlad to see someone else was able to recreate. Hopefully someone can come up with a solution, a little beyond my technical ability. :)
Comment #5.0
Exploratus CreditAttribution: Exploratus commentedMore cleanup.
Comment #6
Adirael CreditAttribution: Adirael commentedI'm having the same issue in 7.x-2.1 and I plan to try to fix it and contribute a patch. Meanwhile I'm using a Contextual Filter with a PHP Code "Provided default value". I'm using the following code to return the latlong value of the field.
If someone wants to use it you'll need to replace "field_geolocation" with your field name and probably do some validation (Did the node load? Is the field empty? Are the values valid?) to avoid nasty errors.
Comment #7
DerTobi75 CreditAttribution: DerTobi75 commentedHi,
got the same problem! Did you have any success with a path, Adiral?
Regards,
Tobi
Comment #8
jemisond CreditAttribution: jemisond commentedAdirael- thank you so much!!! I've been trying for hours to pass geo data from a panels page to views. Works great!
Comment #9
abhi4c4@gmail.com CreditAttribution: abhi4c4@gmail.com commentedusing panles module and add some custom pages in my website. in this process i am getting blank pages when we given wrong path. please any one help me i am trying last 3 days onwards. i tried different types to solve those issues. but i am not getting well.
Comment #10
abhi4c4@gmail.com CreditAttribution: abhi4c4@gmail.com commentedGot the same problem any one success with the path...