content_entity_example.routing.yml

Same filename in other branches
  1. 3.x modules/content_entity_example/content_entity_example.routing.yml
modules/content_entity_example/content_entity_example.routing.yml
6 string references to YAML keys in content_entity_example.routing.yml
ContactDeleteForm::getCancelUrl in modules/content_entity_example/src/Form/ContactDeleteForm.php
If the delete command is canceled, return to the contact list.
ContactDeleteForm::submitForm in modules/content_entity_example/src/Form/ContactDeleteForm.php
Delete the entity and log the event. logger() replaces the watchdog.
ContactForm::save in modules/content_entity_example/src/Form/ContactForm.php
Form submission handler for the 'save' action.
ContactListBuilder::render in modules/content_entity_example/src/Entity/Controller/ContactListBuilder.php
We override ::render() so that we can add our own content above the table. parent::render() is where EntityListBuilder creates the table using our buildHeader() and buildRow() implementations.
ContentEntityExampleTest::testCreateAdminPermission in modules/content_entity_example/tests/src/Functional/ContentEntityExampleTest.php
Ensure admin and permissioned users can create contacts.

... See full list

File

modules/content_entity_example/content_entity_example.routing.yml

View source
  1. # This file brings everything together. Very nifty!
  2. # Route name can be used in several places; e.g. links, redirects, and local
  3. # actions.
  4. entity.content_entity_example_contact.canonical:
  5. path: '/content_entity_example_contact/{content_entity_example_contact}'
  6. defaults:
  7. # Calls the view controller, defined in the annotation of the contact
  8. # entity. This marks this route as belonging to this entity type.
  9. _entity_view: 'content_entity_example_contact'
  10. _title: 'Contact content'
  11. requirements:
  12. # Calls the access controller of the entity, passing in the suffix ('view')
  13. # as the $operation parameter to checkAccess().
  14. _entity_access: 'content_entity_example_contact.view'
  15. entity.content_entity_example_contact.collection:
  16. path: '/content_entity_example_contact/list'
  17. defaults:
  18. # Calls the list controller, defined in the annotation of the contact entity.
  19. _entity_list: 'content_entity_example_contact'
  20. _title: 'Contact list'
  21. requirements:
  22. # Checks for permission directly.
  23. _permission: 'view contact entity'
  24. content_entity_example.contact_add:
  25. path: '/content_entity_example_contact/add'
  26. defaults:
  27. # Calls the form.add controller, defined in the contact entity.
  28. _entity_form: content_entity_example_contact.default
  29. _title: 'Add contact'
  30. requirements:
  31. # Use the entity's access controller. _entity_create_access tells the router
  32. # to use the access controller's checkCreateAccess() method instead of
  33. # checkAccess().
  34. _entity_create_access: 'content_entity_example_contact'
  35. entity.content_entity_example_contact.edit_form:
  36. path: '/content_entity_example_contact/{content_entity_example_contact}/edit'
  37. defaults:
  38. # Calls the form.edit controller, defined in the contact entity.
  39. _entity_form: content_entity_example_contact.default
  40. _title: 'Edit contact'
  41. requirements:
  42. # Calls the access controller of the entity, passing in the suffix
  43. # ('update') as the $operation parameter to checkAccess().
  44. _entity_access: 'content_entity_example_contact.update'
  45. entity.content_entity_example_contact.delete_form:
  46. path: '/contact/{content_entity_example_contact}/delete'
  47. defaults:
  48. # Calls the form.delete controller, defined in the contact entity.
  49. _entity_form: content_entity_example_contact.delete
  50. _title: 'Delete contact'
  51. requirements:
  52. # Calls the access controller of the entity, passing in the suffix
  53. # ('delete') as the $operation parameter to checkAccess().
  54. _entity_access: 'content_entity_example_contact.delete'
  55. content_entity_example.contact_settings:
  56. path: '/admin/structure/content_entity_example_contact_settings'
  57. defaults:
  58. _form: '\Drupal\content_entity_example\Form\ContactSettingsForm'
  59. _title: 'Contact settings'
  60. requirements:
  61. _permission: 'administer contact entity'