Skip to main content
added 7 characters in body
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

drupal debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

Then when you have found the route name you have to add the entity id as route parameter.

Example:

mymodule.links.menu.yml

mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

Then when you have found the route name you have to add the entity id as route parameter.

Example:

mymodule.links.menu.yml

mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

drupal debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

Then when you have found the route name you have to add the entity id as route parameter.

Example:

mymodule.links.menu.yml

mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }
add example
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

Then when you have found the route name you have to add the entity id as route parameter.

Example:

mymodule.links.menu.yml

mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

debug:router

See https://drupalconsole.com/docs/en/commands/debug-router

Then when you have found the route name you have to add the entity id as route parameter.

Example:

mymodule.links.menu.yml

mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

I think changing from url to route_name is the solution, you normally use url only for external links.

You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit

/devel/routes

or from the command line with Drupal Console:

debug:router

See https://drupalconsole.com/docs/en/commands/debug-router