Skip to content

Instantly share code, notes, and snippets.

@sumanthkumarc
Last active May 25, 2017 15:21
Show Gist options
  • Select an option

  • Save sumanthkumarc/4d770a680fbb8d15bce336cd2b2ba6cb to your computer and use it in GitHub Desktop.

Select an option

Save sumanthkumarc/4d770a680fbb8d15bce336cd2b2ba6cb to your computer and use it in GitHub Desktop.
Entity id passed as slug, not loaded as entity in routematch Drupal 8
#When a slug passed in route doesn't load entity on getParameter, you need to pass the entity type as options
#in routing.yml so that the entityconverter knows what it is.
#@link https://www.drupal.org/docs/8/api/routing-system/how-a-node-id-gets-converted-to-its-actual-node-object
#in your routing.yml
route_name:
path: /path/{foo}
options:
parameters:
foo:
type: entity:foo_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment