examples-3.x-dev/modules/config_entity_example/config_entity_example.routing.yml
modules/config_entity_example/config_entity_example.routing.yml
# The routing.yml file defines the paths for our module.
# Here we define the paths for our entity type's admin UI.
# This is the router item for listing all entities.
entity.robot.list:
path: '/examples/config-entity-example'
defaults:
# '_entity_list' tells Drupal to use an entity list controller. We give the
# entity ID here.
# Drupal then looks in the entity's annotation and looks for the "list"
# entry under "controllers" for the class to load.
# @see \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer
_entity_list: robot
_title: 'Config Entity Example'
requirements:
_permission: 'administer robots'
# This is the router item for adding our entity.
entity.robot.add_form:
path: '/examples/config-entity-example/add'
defaults:
_title: 'Add robot'
# Like _entity_list above, _entity_form gives the entity type ID, only this
# time also lists the form separated by a period. Drupal looks in the
# annotation for the entity and locates the "add" entry under "form" for
# the form class to load.
# @see \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer
_entity_form: robot.add
requirements:
_entity_create_access: robot
# This is the router item for editing our entity.
entity.robot.edit_form:
# Parameters may be passed to the form via the URL path. We name the
# parameter in the path by enclosing it in curly braces. For entity forms,
# we include the entity ID in the path by including a parameter with the
# same name as the entity type ID.
path: '/examples/config-entity-example/manage/{robot}'
defaults:
_title: 'Edit robot'
# List our add entry above. This _entity_form entry instructs Drupal to
# read our entity type's annotation and look for the "edit" entry under
# "form".
_entity_form: robot.edit
requirements:
# This uses our entity access controller.
# @see \Drupal\Core\Entity\EntityAccessCheck
_entity_access: robot.update
# This is the router item for deleting an instance of our entity.
entity.robot.delete_form:
path: '/examples/config-entity-example/manage/{robot}/delete'
defaults:
_title: 'Delete robot'
_entity_form: robot.delete
requirements:
_entity_access: robot.delete
