drupal-6


Drupal 6: Adding sub menu items on a menu item?


I have a hook:
function node_field_link_menu()
{
$items['order_food'] = array(
'title' => 'Products',
'page callback' => 'node_field_link_products_page',
'access callback' => TRUE,
'menu_name' => 'primary-links',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
This gives me my menu item and I'm happy with it. The problem is, I want items UNDER this menu item, so I end up with:
- Products
- Product 1
- Product 2
- Product 3
- Product 4
I read that you can use "plid", but the problem is, in this context, I don't know what the PLID is, because I just created the parent. So I can't do this:
function node_field_link_menu()
{
$items['order_food/procuct1'] = array(
'title' => 'Product 1',
'page callback' => 'node_field_link_products_page1',
'access callback' => TRUE,
'menu_name' => 'primary-links',
'type' => MENU_NORMAL_ITEM,
'plid' => XXX?,
);
return $items;
}
So how can I add another menu item below a menu item I created in Drupal 6?
What you did should work without the 'plid'. Drupal recognizes the path pattern and does the job for you. Meaning, if you have a path of 'order_food' and a path of 'order_food/product1', product1 will be the child of 'order_food'.
All you need to do after creating the menu is to clear Drupal's cache.
Just tried it on a new Drupal 6 instance, cleared the cache and I see it working:
$items['order_food'] = array(
'title' => 'Product',
'page callback' => 'node_field_link_products_page',
'access callback' => TRUE,
'menu_name' => 'primary-links',
'type' => MENU_NORMAL_ITEM,
);
$items['order_food/product1'] = array(
'title' => 'Product1',
'page callback' => 'node_field_link_products_page1',
'access callback' => TRUE,
'menu_name' => 'primary-links',
'type' => MENU_NORMAL_ITEM,
);
Opening the URL of "admin/build/menu-customize/primary-links" will show the Product1 as a child of Product.

Related Links

How does one get Drupal's current view/page identifier?
menu item in drupal
Drupal event registration and attendance recording
How do i use Jquery menu in drupal
How to show profile field Values to one simple page in drupal 6?
How can you safely add a dependency to a Drupal module?
Drupal wysiwyg question
How do you separate the template of a blog block in Drupal?
how to know if user is seeing home page or not?
drupal_get_form is not passing along node array
Drupal show / hide fields in view
How do I make the Drupal-Core Forum display only to members, and ask for login details otherwise
Drupal Views limiting content posted by group membership
drupal body class
Drupal does not detect an installed module
Drupal: How can I run a custom function every time a user posts a comment?

Categories

HOME
testing
blogger
fluentd
dxl
baqend
acquia
onelogin
virtualization
here-api
u-sql
zend-framework3
decomposition
http-status-code-504
evopdf
oxyplot
object-detection
jasonette
intentfilter
language-agnostic
claims-based-identity
virtualdub
fopen
log4js-node
subdomains
procdump
sql-server-2012-express
catel
calibre
hybridauth
uiswipegesturerecognizer
html5-fullscreen
overlap
libraries
streamsets
keydown
slick-3.0
dotcover
youcompleteme
python-webbrowser
jlink
brightcove
google-perftools
google-cdn
log4c
ado.net-entity-data-model
elements
measures
py2app
impresspages
qgraphicsview
nessus
ios4
asp.net5
photobucket
tcpserver
separator
cyclomatic-complexity
tmuxinator
citrus-pay
browser-bugs
map-projections
riak-cs
myo
composite
bridge.net
truevault
offloading
jscript.net
phalanger
rdtsc
id3v2
googlemock
mysql-error-1062
bundles
monomac
gwt-rpc
rabl
orchardcms-1.7
interface-orientation
lcs
libstdc++
gil
viewswitcher
onsubmit
assembly-loading
transactionscope
spyware
external-accessory
mod-auth
ecl
site.master
routedevent
asp.net-profiles
castle-monorail
uiq3

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App