Questions tagged [drupal-routes]

Routing is an important part of writing a module. In order to expose content or functionality on specific URIs on a Drupal site, routes or path are mapped to function callback. Drupal 8's routing system is heavily based on Symfony's, whereas prior versions relied on the routing parts of hook_menu().

20 questions
13
votes
2 answers

Optional argument in Drupal hook_menu implementation

How can I set one of the page arguments in my drupal menu item as an optional page argument? I have $items['activities_list/%/%']=array( 'title callback' => 'activities_list_title', 'title arguments' =>array(1), 'description' =>'All the Indicators…
perpetual_dream
  • 1,046
  • 5
  • 18
  • 51
12
votes
8 answers

Drupal: How to Rebuild Menu Navigation

In Drupal 7.0, when I change a routing path/menu from the type MENU_NORMAL_ITEM to the type MENU_CALLBACK, Drupal 7.0 does not remove the item from the menu_links table. I'm not sure if this is a bug or not, but I've filed one with the core…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
12
votes
1 answer

Drupal 7 hook_menu for specific content type

I tried to add a new tab to a specific content type 'abc', here is the code, but it doesn't work, the tab shows on all the nodes. Can anybody help with it? Thank you! function addtabexample_menu() { $items=array(); $items['node/%node/test'] =…
user1480765
  • 177
  • 3
  • 11
6
votes
2 answers

Drupal 7: How to Create a Menu/Route Item That Doesn't Appear in the Site Navigation

How can I create a new route/menu in Drupal that doesn't automatically render a navigation link? I'm trying to create a simple page callback in Drupal that doesn't show up in the Navigation menu. I have a module named helloworld. The .module file…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
4
votes
3 answers

Why am I getting a page not found error after creating a new menu item?

In my module file I created a new menu item function xmlproject_menu() { $items = array(); //more items here $items['system/xml/cfa/initialize/%/%/%/%/%'] = array( 'page callback' => 'xmlproject_initialize_cf', 'page arguments' =>…
AllisonC
  • 2,973
  • 4
  • 29
  • 46
3
votes
2 answers

Drupal 6 absolute wildcards in _menu(), is it possible?

is it possible to handle all wildcards in _menu() by module. I know about specific wildcards like display/page/% but that won't work for paths display/page/3/andOrderBy/Name what If I want to handle unpredicted ammount of parameters…
David King
  • 2,010
  • 5
  • 19
  • 23
2
votes
1 answer

user->uid alway is 1 for whatever user?

I'm new for Drupal , so I want to create a simple module that custom user profile, specically I want insert some tabs for user profile (the traditional user profile have 2 tabs "View tab" and "Edit Tab") so now I want add more 3 tabs. Show…
tunghk_54
  • 135
  • 1
  • 4
  • 14
1
vote
1 answer

Drupal Breadcrumbs and modules

I have created a module but the page structure is not picked up by the breadcrumb so I would expect this to be home > personal > contact form and what I get is home > contact form it is like the structure is ignore, what do I need to do to get this…
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
1
vote
0 answers

Altering a dynamic route in Drupal 8 with RouteSubscriber

I have a web-app made in Drupal 8, and I have some routing problems. Users will login using an external service, and after login they are sent to the path /user/{user}, where {user} is their user id. I want to change this behaviour and send them to…
Richard Jensen
  • 176
  • 1
  • 14
1
vote
1 answer

Is there way to use Drupal menu's "page arguments" in the "access callback" function?

Is there way to use Drupal menu's "page arguments" in the "access callback" function? I need to use both 'access arguments' and 'access callback' 'page arguments' => array(3, 4), 'access arguments' => array('access mymodule data'), 'access…
Sudev
  • 11
  • 3
1
vote
5 answers

Modify the title given in hook_menu() from another module

How can I change the title given to the /user/[uid] page from Your account to Welcome [user name] for logged-in user, where [user name] is the username for the currently logged-in user?
user1920216
0
votes
1 answer

Drupal menu , duplicate node content

In drupal 6 the node menu is $items['node/%node']. This should give a url like www.sitename.com/node/1 but when accessing www.sitename.com/node/1/something again the same menu is called, thus making the contents of www.sitename.com/node/1/something…
0
votes
1 answer

Replicate /system/files to get route or query param with full path

I'm trying to understand how the /system/files route works in Drupal 10 (or 9). My goal is to get a controller for a path which can have an unknown amount of subfolders and should stream files like /system/files does (with some custom behavior and…
mpj
  • 3
  • 4
0
votes
1 answer

Why are characters inserted in my PHP link?

I created a module, but the link is not correct. My site now shows : /store/2?0=/cgv The correct link should be : /store/2/cgv Why doesn't it work ? where is the error ? What should I change in the code below, to get the link ?
553aa08930
  • 33
  • 7
0
votes
3 answers

Drupal: Create menu item for a view

I am creating a small reservation system. you can create nodes of a type that can be reservated, like a projector. I have a calendar view with normal displays. I addes an argument for the node reference, but I have problems defining the page…
Nealv
  • 6,856
  • 8
  • 58
  • 89
1
2