Web Development Tips

Drupal : Find the path or menu available in drupal site.

Posted by: slvramesh on: September 1, 2010

When you going to add or edit path / menu in your site, it is necessary to check the menu are already taken by the site, other wise it will conflict.
When you create internal menu the drupal system automatically check with you site. but when you create external or via coding the below code will help to validate the path already taken or not.

All the internal or external menus are stored in the table “menu_router”.

/*
* Find the path is available
* Parameter menu path
* return TRUE if menu exists else return FALSE
*/

function is_path_exists($path) {
return (db_fetch_array(db_query("SELECT * FROM {menu_router} where path = '%s' ", $path))) ? TRUE : FALSE;
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.