I want to create a customized media library for my editors, with a tab navigation similar to the tabs on core's admin/content view. It basically works, but I also want to add a tab leading to a specific "media" taxonomy vocabulary used by my media entities. As soon as I add the taxonomy tab to my YML file, the base_route filter no longer works.

Screenshot with correct behaviour on view pages: Works correctly on view page

Screenshot with unwanted tabs on taxonomy page: Unwanted tabs on taxonomy page This is my custom modules' links.task.yml.

# a common view page for all media types
  route_name: view.medialibrary.medialibrary
  base_route: view.medialibrary
  title: 'All media types'
# a view page only for images
  route_name: view.medialibrary.imagelibrary
  base_route: view.medialibrary
  title: Images
# a view page only for videos
  route_name: view.medialibrary.videolibrary
  base_route: view.medialibrary
  title: Videos
# a view page only for documents/files
  route_name: view.medialibrary.filelibrary
  base_route: view.medialibrary
  title: Documents
# as soon as I activate the following entry, all the tabs are shown
# on every taxonomy overview page, this is not wanted
  route_name: entity.taxonomy_vocabulary.overview_form
    taxonomy_vocabulary: media
  base_route: view.medialibrary
  title: Manage Categories

How can I prevent my custom tabs from appearing on the taxonomy overview pages?

1 Answer 1


You can use hook_menu_local_tasks_alter() to see what all elements are added and can remove elements based on any conditions you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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