1

I made a custom entity type and I'd like it added to the tabs on the content page seen below.

enter image description here

My custom_entity.links.menu.yml Looks like this

entity.custom_entity.collection:
  title: 'Custom Entities'
  route_name: 'entity.custom_entity.collection'
  description: 'List Custom Entities'
  parent: system.admin_content
entity.custom_entity.add_form:
  title: 'Add Custom Entity'
  route_name: 'entity.custom_entity.collection'
  description: 'Add custom entity'
  parent: entity.custom_entity.collection
custom_entity.admin.structure.settings:
  title: 'Custom Entity Settings'
  description: 'Configure Custom Entity'
  route_name: 'custom_entity.settings'
  parent: system.admin_structure

And it does display the custom entity pages in the admin menu but it does not appear amongst the tabs on the content page. Is there a separate yml file that governs that?

1 Answer 1

4

Those tabs called "local tasks." See Providing module-defined local tasks on d.o.

In the simplest case you can define your local tasks in a yaml file:

# example.links.task.yml

example.admin: # The first plugin ID
  route_name: example.admin  
  title: 'Settings'
  base_route: example.admin

example.admin_3rd_party: # The second plugin ID
  route_name: example.admin_3rd_party
  title: 'Third party services'
  base_route: example.admin
  weight: 100

But, it's also possible to define dynamic local tasks.

Per @Matt in the comments, if you want to place this as a tab on the /admin/content page, use base_route: system.admin_content.

1
  • 2
    Thanks this worked! It's enough info to land on the answer but If you like, you could mention that the base route would be system.admin_content since the question specifically asked about how to make it appear on the content page.
    – Matt
    May 26 at 18:08

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.