开发者

How to get all paths in drupal install

I need to write a module that gives me a page will all possible paths in a drupal install, including orphaned pages. (site map won't work for that).

I can query the url_alias table for aliases, and I can query the menu_router table for all paths, even ones set in page/feed displays in views. But, variable paths (those with arguments) get interpreted at run-time.

So, is there a way to get all possible paths in a drupal install, includi开发者_运维问答ng dynamic paths and orphans? It's catch22. I have to know all the urls ahead of time to get them.


So, you can definitely get all possible paths in drupal by querying the url_alias table (that gives you all aliases), and menu_router, which will in addition give you paths set by page or feed displays. The problem remains that you cannot fill in the variables in variable paths in the menu_router table. You have to know in each case what the variables could be, since Drupal fills them in at runtime.

So my problem is a catch22. You have to somehow visit all the paths to get them, but you can't programatically visit them (or crawl them) unless you know what they are in advance.


All possible paths in Drupal itself? menu_links table should have all of that listed as registered paths in the system.


You may want to check out the menu_edit_validate() function to see how drupal checks if the link for a new menu item has a valid path.

I don't think it's possible to get a list of all possible paths including the ones with variable values in it. The essence of such a dynamic path is that is can accept multiple values. Of course you could loop through the menu items and, when you come across node/%node/edit, add a new item to your list for every node ID in your database. However I don't see how that could be useful for anything....

Can you explain which problem you're trying to solve? Maybe we can help you find an even better solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜