Creating a route provider
Entities can implement a route provider that will create the route definitions for the entity's canonical (view), edit, and delete routes. As of Drupal 8.0.1, the add path for an entity is not handled through the default route provider.
In this recipe, we will extend the default
\Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider and provide the add routes for our entity.
You will need a custom module to place the code into in order to implement a configuration entity type. Create an
src directory for your classes. A custom content entity type needs to be implemented, such as the one in the Creating a content entity type recipe.
How to do it…
- Create a
MessageHtmlRouteProviderclass in the
srcdirectory that ...