Drupal 7 custom module for menu I am developing a custom module that will have the functionality to show a particular menu link active on the desired path. For this I have implemented hook_form_FROM_ID_alter() hook for menu_edit_item(). In the edit form of each menu item there I have provided options similar to block modules page visibility options


Active on all pages except listed
Active only on listed pages
Active depending upon given php code


But I need to match the path listed with any existing path. Do I need to implement other hook or create more functions to implement this or this functionality should be implemented in hook_form_FROM_ID_alter(). I have also created a database table for this that stores


menu link ID
Visibility (i.e. flag to the option chosen by the user 0, 1, 2)
Pages (i.e the paths given by the user in the textarea eg: node/4,
etc)


Thanks for your help in advance
This is an existing module which does part of what you want to do. The module is Menu item visibility. I recommend looking at how it works and extending it (it says it's extendable) to add the extra pieces you are requesting: visible per page, or visible on PHP code. It probably has hooks you can use to complete your business logic.

In fact, this issue talks about adding "per page" or "php code" conditions essentially.