I've just begun the transition process from D7 to D8. I installed D8 and added a basic page w/ a menu link. I then began to explore the new D8 routing system and expected to find a .yml file that contained information about where to find the added page but I don't see it. This is not a added module so it doesn't have a moduleName.routing.yml.

I'm looking for a conceptual description of why this does or doesn't follow the new .yml convention.

  • The routing system in drupal 8 (much like drupal 7) uses placeholders to describe dynamic routes. If you would look at node.routing.yml you would find the route that describes node pages. – Eyal Jan 15 '16 at 16:28
  • @Eyal Probably not, it's an entity - those routes are defined elsewhere IIRC – Clive Jan 15 '16 at 16:34
  • Looks like they're in the entity annotation itself @Eyal – Clive Jan 15 '16 at 16:35
  • Defining the links in the entity annotation does not create a routing object. Though it is possible to use a route subscriber and use the link templates. – Eyal Jan 15 '16 at 16:38
  • @Eyal Any idea where they are in that case? They're not in node.routing.yml – Clive Jan 15 '16 at 17:07

Node routes are declared using what is known as a route provider. The node route provider class is \Drupal\node\Entity\NodeRouteProvider and it is declared in the annotation of the node class:

 * @ContentEntityType(
 *   id = "node",
 *   label = @Translation("Content"),
 *   bundle_label = @Translation("Content type"),
 *   handlers = {
 *     ...
 *     "route_provider" = {
 *       "html" = "Drupal\node\Entity\NodeRouteProvider",
 *     },
 *     ...
class Node extends ContentEntityBase implements NodeInterface {
//  ...

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.