1

I have a menu like the following defined in mymodule.links.menu.yml:

mymodule.page_memos:
  title: 'List of memos'
  description: 'View list of memos'
  route_name: view.document_list.page_1
  route_parameters: { doctype: 'memo'  }
  menu_name: main
  weight: 100

mymodule.page_letters:
  title: 'List of letters'
  description: 'View list of letters'
  route_name: view.document_list.page_1
  route_parameters: { doctype: 'letter'  }
  menu_name: main
  weight: 200

mymodule.page_notes:
  title: 'List of notes'
  description: 'View list of notes'
  route_name: view.document_list.page_1
  route_parameters: { doctype: 'note'  }
  menu_name: main
  weight: 300

and then a list of tasks defined in mymodule.links.task.yml:

mymodule.document_list:
  title: 'List of documents'
  description: "View full list of documents"
  route_name: view.document_list.page_1
  base_route: view.document_list.page_1
  weight: 10

mymodule.create_doc_by_type:
  title: 'New document'
  description: 'Insert new document'
  route_name: mymodule.create_doc_by_type
  base_route: view.document_list.page_1
  weight: 20

Everything work as expected, with three tabs in the main menu and two tabs in the task (they will soon become more). There is only a small visual glitch: when I click on tabs in the main menu, the last one clicked is correctly marked as active; when I click on tabs on the task menu, only the first one is ever marked as active. I am sure this has to be something really minor, but I really don't know how to search for a solution.

  • Have you tried switching themes to confirm is not a theme issue? – No Sssweat Oct 30 '18 at 19:23
  • I don't understand what you mean by "theme issue", anyway I tried the unmodified Bartik (in my project I am using a customized Bartik), and the issue is still present; I tried Professional responsive, which does not mark the selected tab at all; I tried Business, and the issue is still there. – Francesco Marchetti-Stasi Nov 7 '18 at 11:03
0

I came back to study this problem further. If I am not mistaken, the active trail is not set from the local task to its parent menu link, even if the first local task is correctly set to the corresponding menu voice. I looked at a few modules and custom solution, and in the end I simply changed a bit my URLs and installed the module menu_trail_by_path, and I got the desired behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.