I'm studying the content_entity_example module and there are some things I'd like to understand better. In the file content_entity_example.routing.yml there is this block:

   path: '/content_entity_example_contact/list'
   # Calls the list controller, defined in the annotation of the contact entity.
     _entity_list: 'content_entity_example_contact'
     _title: 'Contact list'
   # Checks for permission directly.
     _permission: 'view contact entity'

This is the routing path that shows the contact list, but I did not understand what it means

_entity_list: 'content_entity_example_contact'

Examples are avaiable

The examples are available at this link: Drupal 8 examples


As the comment states, it looks at the defined entity (Contact) and checks the value of the annotation in Contact.php which is Drupal\content_entity_example\Entity\Controller\ContactListBuilder to see what its entity list builder class is. It knows this because content_entity_example_contact resolves to the class, because it has an id annotation defining it as such.

See: https://cgit.drupalcode.org/examples/tree/content_entity_example/src/Entity/Contact.php

|improve this answer|||||

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.