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
.
mymodule.mytask:
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).
The tab "file" for example is configured in a view:
admin/structure/views/view/files:
PAGE SETTINGS
Path:/admin/content/files
Menu:Tab: Files
You can do the same with yml files in your module:
Providing module-defined menu links
An example from core module comment:
mymodule.links.task.yml:
comment.admin:
title: Comments
route_name: comment.admin
base_route: system.admin_content
(credit: comment from Berdir)