views:

23

answers:

1

I have no need for the node "view" screen/tab for certain types of content.
Instead, when a user goes into /node/nid I wish to show the node edit form.

Any ideas on how I do that?

thanks,
Omer.

+1  A: 

A way to do it, would be to use hook_menu_alter to change the node/[nid] menu item and call you own function. In that function you could check the node type and either call the function used to display the node or the one used to display the node form.

googletorp
I tried that. I use pathauto to change the prefix from 'node' to something else (e.g. 'pref'), and implemented hook_menu_alter to call a function that renders the edit form at the same path. The pathauto setting seems to override my menu_alter, as I still see the view form (changing my menu_alter to 'other_pref' renders the form with no problem)
Omer
Pathauto doesn't change the internal path, so even if you change node/[nid] to pref/[nid], it is still node/[nid] that's called internally. You don't need to change the url with the `hook_menu_alter`, only the menu callback.
googletorp
my bad. mixed up hook_menu and hook_menu_alter. I'm looking into hook_menu_alter, seems to be in the right direction.
Omer

related questions