Closed (won't fix)
Project:
Node import
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Dec 2007 at 13:27 UTC
Updated:
23 Apr 2011 at 13:51 UTC
Cool, this is working exactly like I want it.
I've just added an extension for menu support! - based on the assumption that structured values in a 'path' imply actual structure.
This works just fine, but now I can't see how to turn it off :-)
When this supported/menu.inc file is present ... it just goes, but I cannot find where in the import wizard I should add a setting to disable it, or to define the root menu it builds the files under.
Now this is a cool tool for fast prototyping a sitemap for me!
| Path | Title |
|---|---|
| home | Home |
| about | About Us |
| products | Product overview |
| products/consumables | Consumables |
| products/rigging | Rigging |
| products/effects | Stunt Gear and Special Effects |
| products/workshop | Workshop |
| products/vehicles | Vehicles |
| products/vehicles/truck-a | Truck A |
| products/vehicles/truck-b | Truck B |
| Comment | File | Size | Author |
|---|---|---|---|
| demo_content.csv_.txt | 1.02 KB | dman | |
| node_import-supported-menu.inc_.txt | 2.99 KB | dman |
Comments
Comment #1
Robrecht Jacques commentedWoah, extremely useful.
If I understand it correctly, you deduce the menu from
$node->path. This means the user needs to assign a column from the CSV file to path (seesupported/path.inc). I think it is better to make a seperate field for it:Then in
menu_node_import_postprocess()use$node->node_import_menuinstead of$node->path. This way one can disable the feature (by not mapping the "Menu: menu path" field to any column) and it becomes possible to have a different menu path and normal path.Your other problem is how to specify the menu the stuff is built under. You would need to implement some
menu_node_import_global()for that which returns a form. If you need some help with that, tell me.The code itself looks good, except for the messages. Eg:
should be:
this way strings can be translated AND you avoid injecting stuff into the messages.
Also:
This 118 should be some combination of constants instead of a number.
I did not test it fully, but if you can work on it a bit more, it's likely to get included.
If you can't work on it anymore, please tell me.
Comment #2
dman commentedMmm,
I do assume that the URL structure of my websites should reflect the menu navigation path. And vice versa. I just find that the most sensible, and actually think that deliberately breaking that convention by having URLs imply one thing and the menus built differently would be a gross architectural mistake.
I see what you are suggesting with adding a whole 'nother column, and that would enable me to turn this feature on and off by not using it ... But I was just trying to find the right place in the UI (2 1/2 months ago) to insert a checkbox :-)
Yeah, I was a bit lazy with a t() somewhere. That happens in prototype code.
I don't think I actually deciphered what that menu number means :-} so I'm not sure of the constants. I just copied it out of my database after a few failed attempts to guess the right constants.
I'm still unsure how you suggest to present a menu selector to choose the root. I couldn't figure the hook or callback.
What I've done so far is
- Manually create one menu - either a root or placed somewhere - and named it with an alias.
- Then I run an import with my paths starting with that alias. The system finds the parent menu and proceeds to build the children off there.
This works perfectly for me, but is a slightly obscure process for users I guess.
If I was to add the user selector, we'd also have to have a 'create new menu item' option etc.
I just didn't at the time because I couldn't find a way to hook into the process at the right time - how to alter the form or something - from the include file.
I've got work on at the moment, and am way past the prototype I needed this for. But I'm still developing lots of stuff with import/export so I'll probably revisit this tool again eventually.
... but just not in a hurry right now, sorry.
Comment #3
Robrecht Jacques commentedUnderstood. I'll look into it later myself. Menu == path makes sense.
Comment #4
Robrecht Jacques commented5.x-1.x is no longer supported. Menu support has been added to 6.x-1.x.