I want to reflect the menu-structure in the path.

I will soon write a module for this purpose (but only for nodes, i think). How should i call it?

DFG

Comments

mikeryan’s picture

Assigned: dfg » mikeryan
Category: task » feature

Request noted. If you come up with a patch, feel free to share it by attaching it to a reply here.

Reassigning issue to myself (the pathauto maintainer).

dfg’s picture

A first version of my menu feature is ready.

I made changes to pathauto.module and pathauto_node.inc

I also made a new file, pathauto_menu.inc, with the main functionality.

I would like to upload it to cvs, but my request isn't accepted until now :/

Uwe Hermann’s picture

You shouldn't simply commit to CVS without asking the maintainer of the module. Please post a patch here for review first.

dfg’s picture

(1) http://d-f-g.net/drupal/pathauto-menu/node-view.png
Here you can look at a path generated with my add-on.

(2) http://d-f-g.net/drupal/pathauto-menu/admin-menu.png
Here you can see the menu structure in the Admin Menu.

(3) http://d-f-g.net/drupal/pathauto-menu/phpmyadmin-menu.png
More information about the menu structure.

(4) http://d-f-g.net/drupal/pathauto-menu/phpmyadmin-pathauto_menu.png
When you look at the URL in (1) you can see "math" instead of "mathematics" and "numbers" instead of "number-theory". Thats because of the table in (4). This table is still experimental (there is no way to configure it via drupal, though we could add a way on several pages). This table won't be used if PATHAUTO_MENU_TABLE is not defined. Also the table has not to be present in the database. PATHAUTO_MENU_TABLE is NOT defined by default. See the first lines in pathauto_menu.inc

(5) http://d-f-g.net/drupal/pathauto-menu/phpmyadmin-url_alias.png
Now you understand the url aliases.

(6) http://d-f-g.net/drupal/pathauto-menu/pathauto-settings.png
There are three new things:
- the pattern box for nodes that are in the menu
- the placeholders [menu] and [menupath]

'pathauto_node_menu_pattern' has precedence over all node patterns, but will only apply if the given node is in the menu (and my add-on is active, of course). If pattern is empty or the node not in the menu, it will continue with the content type pattern and then with the default pattern.

(7) pathauto.module.patch and pathauto_node.inc.patch
These patches are stable: even when pathauto_menu.inc is not in path or wasn't included, pathauto will work as without these patches.

(8) pathauto_menu.inc
The core code for my add-on.

(8) pathauto_menu.sql
Optional table for using another title as url-part, and not the corresponding title in the menu table, e.g. "math" instead of "mathematics".

dfg’s picture

StatusFileSize
new1.08 KB

pathauto.module.patch

dfg’s picture

StatusFileSize
new1.61 KB

pathauto_node.inc.patch

dfg’s picture

StatusFileSize
new2.15 KB

pathauto_menu.inc

dfg’s picture

StatusFileSize
new134 bytes

pathauto_menu.sql

mikeryan’s picture

Thanks for the patches - I'll review them when I have time. I'm afraid I'm flat out at the moment, between the day job, my primary site, and a contract I'm doing on the side, I only have time for bug fixes on my contributed modules.

jakeg’s picture

looks like a great idea DFG. I'll check it out tomorrow perhaps.

mikeryan’s picture

Version: 6.x-1.x-dev » 4.6.x-1.x-dev
Status: Active » Fixed

OK, I've done a basic implementation of this functionality, using the new pathauto_node hook (so no hacking of pathauto.module and pathauto_node.inc necessary). I will commit to cvs later today.

mikeryan’s picture

Status: Fixed » Closed (fixed)