By nancydru on
I have read Multiple pages on the same dynamic path (node types) and Dynamic argument replacement (wildcard) but I don't think they cover my specific coversion need, or maybe I'm just too dense.
In 5.x we had two tabs on the content type add page, "Add" and "Import," that were done with this menu structure:
$items[] = array(
'path' => 'node/add/quotes',
'title' => t('Quotes'),
'access' => (user_access('create quotes') || user_access('import quotes') || user_access('edit own quotes'))
);
$items[] = array(
'path' => 'node/add/quotes/add',
'title' => t('Add'),
'access' => (user_access('create quotes') || user_access('edit own quotes')),
'type' => MENU_DEFAULT_LOCAL_TASK
);
$items[] = array(
'path' => 'node/add/quotes/import',
'title' => t('Import'),
'access' => user_access('import quotes'),
'type' => MENU_LOCAL_TASK
);
In 6.x we are not to include "node/add." So how does this multiple tab set up work?
Comments
Your information is
Your information is incomplete and unclear. Is that 5.x menu definition in the cached part? Is 'quotes' a node type or something else?
node types are added automatically as node/add/X, so don't define that path again. you probably need something like:
Note - do not use
t(), define an access callback for anything complicated, the default access callback isuser_access()note that the normal access callback for node/add/quotes will be
node_access('create', 'quotes').---
Work: BioRAFT
Thanks
Yes, I know to leave out the t() calls. This is in the $may_cache section.
So, basically you're saying just yank out the original node/add path and leave the other two (with minor changes).
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Coder still complains
The complete menu set is:
Coder flags both of them.
NancyDru
Don't understand
we are not to include "node/add." <= I can't understand this. Someone told you to not include node/add? Where? what?
--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.
Added automatically
It is stated several places that this path is added automatically and should not be coded. It's even in pwolanin's comment above, and flagged by the Coder module.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Coder problem?
Well. I think in this case you may need to ignore Coder or suggest a patch for it. The docs you are referencing (and from which the Coder rule may be derived) probably just don't anticipate local tasks being added to this page.
---
Work: BioRAFT
Thanks
I am already doing the former and plan on the latter.
Nancy W.
NancyDru
Next problem
Okay, the above stuff is working. Except that there is no regular node/add stuff included on the form for the "node/add/quotes/import" menu entry (it is there for the other). I assume this is because it is not a plain "node/add" path. Can this be fixed easily?
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
custom node type?
You still have to define all the usual hooks for a custom node type.
---
Work: BioRAFT
I have
This is an existing module that works just fine in 5.x. I'm just upgrading it to 6.x.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru