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.
We partly started implementing support for a "menu_path" option in hook_menu_alter(). This can be used to move the REST API path for a resource to something different than /resource_type. Example: one might wish to move "/node/1.json" to "/api/version2/node/1.json".
We need to document this and fully implement it in hook_menu_alter().
Comment | File | Size | Author |
---|---|---|---|
#21 | restws-menu-path-1697558-21.patch | 3.44 KB | mr.baileys |
#21 | restws-menu-path-interdiff.txt | 1.13 KB | mr.baileys |
#18 | restws-menu-path-1697558-18.patch | 3.51 KB | mr.baileys |
#16 | restws-menu-path-1697558-16.patch | 3.21 KB | mr.baileys |
#15 | restws-menu-path-1697558-15.patch | 3.26 KB | mr.baileys |
Comments
Comment #1
sepgil CreditAttribution: sepgil commenteddone, added even a test :-)
Comment #2
sepgil CreditAttribution: sepgil commentedComment #4
sepgil CreditAttribution: sepgil commentedPatch should now run through.
Comment #5
klausishould be menu_path, not menu_info. Also documentation on hook_restws_resource_info() is missing.
"For modules, a single [module name].test file is the general rule. It should be placed directly in the module folder." from http://drupal.org/node/325974
That comment does not relate to any code statements here?
Should have an @see reference to the test method.
Comment #6
sepgil CreditAttribution: sepgil commentedFixed the issues mentioned by klausi.
Comment #7
klausiDid some small modifications and committed this.
Now we need to fix all the URLs that are being used in resource references and querying. And we need tests that verify that the changed menu path is printed correctly in the format output.
Comment #8
sepgil CreditAttribution: sepgil commentedI modified restws_resource_uri() so, that it can be used for any restws uri.
Comment #9
klausiCommitted a slightly modified version of your patch.
Now the only missing thing are tests that verify that the changed menu path is printed correctly in the format output.
Comment #10
sepgil CreditAttribution: sepgil commentedThis patch adds the missing tests and fixes the other menu path tests, which were broken. Had to create a new test class, since enabling the test module wouldn't work with module_enable().
Comment #11
klausiDo not duplicate the httpRequest() method. The new test class should either extend the first class or you need a third class as common parent class to the actual test classes.
I guess module_enable() did not work because the menu needs to be rebuild, so that the new paths get recognized (menu_rebuild()). Please try that again.
Comment #12
fagoalso see #1820864: Make taxonomy terms play with uuid_redirect
Comment #13
klausiTagging.
Comment #14
klausiMarked #2286515: Multipart menu_path's are not working as a duplicate.
The testMenuPath() method is quite broken now and does not test the right thing. Maybe we should make restws_test_restws_resource_info_alter() configurable with variable_get(), so that each test can specify what the test path should look like.
Comment #15
mr.baileysTests + fixed a bug where menu_path containing a period "." was not working.
Comment #16
mr.baileysForgot a left-over debug statement in previous patch.
Comment #17
klausiExcellent work, almost there!
We should also assert that the returned content in the response body is correct. You can check for the title of the node for example.
Same here.
Comment #18
mr.baileysAdded the assertion on node title back in as per #17.
Comment #19
mr.baileysNot sure why the patch was attached twice, but both files are the same.
Comment #20
klausiYeah no, the original assertion is wrong. Comparing the title that we generated with the node does not make sense. You need to pull out the title from the result of drupalGet().
Comment #21
mr.baileysThat does make more sense. New patch & interdiff attached.
Comment #22
klausiCommitted, thanks!
Comment #24
klausiOops, forgot to push that commit, done now!