Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By kaalmans on
Hi,
I would like to modify link's path on a menu. How to do? Am I supposed to use hook_menu? Do you have an example?
Comments
If you want to modify a menu
If you want to modify a menu link defined by another module you would implement hook_menu_alter()
OK. I have to write my code
OK. I have to write my code on the hook_menu_alter(). So, I am creating my first module but it's a little bit difficult to find all the functions I need on the documentation.
Here my algo:
If (I am on my destination menu) Then
For each links of my menu
url=current_url+link_name
End If
It is not clear what you are
It is not clear what you are trying to do.
Are the menu entries you are trying to modify from your module or elsewhere?
How/why are you trying to modify them?
I have created a view with 2
I have created a view with 2 arguments.
When I am on my page www.mywebsite/destination/COUNTRY, i have a new menu "category" which allow me to display for example every hotel of a country.
I would like to modify the links of the "category" menu to have something like www.mywebsite/destination/COUNTRY/CATEGORY. The idea was to override the link... Am I wrong?
NB: the "category" menu come from a taxonomy
Any help?
Any help?
Any recommendation?
Any recommendation?