I'm new to drupal, so sorry if this is a stupid question.

While developing a module, is it possible to add a tab to the /admin/content page (where by default there is content, comments, files)

Currently using 8.0.6


Similar to Drupal 7, tabs are called "local tasks". Your module should implement a local task and a route.

The complexity in this is that /admin/content is a views-generated route with a system module fallback in case the view is disabled (as explained by @Berdir below), and the base route should be system.admin_content.

  title: 'My Task'
  route_name: 'mymodule.mytask.route'
  base_route: 'system.admin_content'
  weight: 1

If the view itself isn't altered, then the route is view.ID.page_NUMBER. I've done this latter thing working on an entity example module in my sandbox (Shift).

  • 1
    Almost correct, /admin/content is a special case that's defined in system.routing.yml and then overridden, so that there's a fallback if views/node isn't enabled. The route name is system.admin_content, see comment.links.task.yml – Berdir Apr 8 '16 at 18:16
  • I was so close... Had implemented the route and added it to system.admin_content. Just in the .links.menu.yml file not the task one. – Jazzer Apr 8 '16 at 21:37

The tab "file" for example is configured in a view:

Menu:Tab: Files

You can do the same with yml files in your module:

Providing module-defined menu links

Routing system in Drupal 8

An example from core module comment:


  title: Comments
  route_name: comment.admin
  base_route: system.admin_content

(credit: comment from Berdir)

  • Sorry. I saw your answer second so the tick went to mradcliffe. Good answer and thanks for the links too. – Jazzer Apr 8 '16 at 21:41

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.