Hi,
I want to provide a link to an entity type's form-display tab. The correct way (I understand) is to use Url::fromRoute('the.route.to.the.page', [params]). The final url I want is /admin/structure/types/manage/{node_type}/form-display but the route for this is missing from file node.routing.yml. The nearest is just /admin/structure/types/manage/{node_type}

I have added a new route in my own custom module.routing.yml as follows:

entity.node_type.form_display:
  path: '/admin/structure/types/manage/{node_type}/form-display'
  defaults:
    _entity_form: 'node_type.edit'
  requirements:
    _permission: 'administer content types'

This works perfectly and I can use Url::fromRoute('entity.node_type.form_display', ['node_type' =>'my_node_type'])->toString().

My question is why is this route not provided in Core node.routing.yml? Maybe I am mis-understanding something, and there are so many routes that not all are provided for. I thought it was best to discuss this here first, not raise an issue on the core queue immediately.

Thanks for reading,

Jonathan

Comments

jonathan1055’s picture

I have raised a core issue to get the missing route added
#2865983: Add missing route for /admin/structure/types/manage/{node_type}/form-display