Closed (fixed)
Project:
RESTful Web Services
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2011 at 12:51 UTC
Updated:
20 Dec 2011 at 09:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
klausiIt is not documented and matured yet, but we have planned a bit for such cases. You can use hook_restws_resource_alter() and set something like this
Caution: If you retrieve nodes from that path and they contain reference links to other nodes, the path will probably not be correct (i.e. will be "/node/1.json"). If that does not matter to you, you shouldn't have a problem. Anyway, this has not been tested yet so I would appreciate your feedback :-)
Comment #2
fagohm, #1 is a possible workaround but it basically disables restws for the path node/%. It would be great to find ways to work even if panels is already altering the menu. Maybe just shuffling with module weights would work?
Comment #3
Dinesh Kumar Sarangapani commentedI have tested as per #1, but it doesn't seems to work, as the page call back 'restws_page_callback' uses arg(1) to get the resource id, having a altered menu path via code may have the id in different position. say restws/node/1.json returns arg(1) as node, which leads to 404 NOT FOUND
Comment #4
Dinesh Kumar Sarangapani commentedModified the function as below
Works for me...
Comment #5
Dinesh Kumar Sarangapani commentedAs per #2 Even after shuffling weight of the module one has to override another..
Comment #6
Dinesh Kumar Sarangapani commentedComment #7
seanburlington commented@klausi
This almost works
But moves the arg so that this no longer works
I can hack it so that the arg() position is adjusted, then it seems OK
Comment #8
seanburlington commentedOK I've looked into this some more
It seems that restws alters the menu - but if the requests isn't a rest-ish one then it tries to pass the call back to what it was (which is the original node handler)
page manager sets a high weight for itself so it is called after restws, sees the menu is changed and goes off in a sulk (quietly aborts the menu alter)
So if we make restws have a higher weight it is called after page manager and the sequence is
page manager sees the original node menu and is happy, restws alters the menu again - but it's callback falls over to what it was before restws altered it - this now falls back to the page manager hook :-)
The attached patch alters the weight of restws to be 1 greater than the page_manager module weight which is 99
Comment #9
seanburlington commentedNB - this patch adds an install / update hook
apply the patch and the run updb if you have already installed the module
Comment #10
klausiPlease take a look at the patch in #1343816: Unconditional altering and overriding of existing menu links breaks comment permalinks and possibly others and test if it fixes the issue for you.
Comment #11
klausiCommitted the patch in #1343816: Unconditional altering and overriding of existing menu links breaks comment permalinks and possibly others, please re-open if this is still an issue.