Add a wildcard route translator service to catch all available routes

Created on 12 October 2022, over 1 year ago
Updated 2 February 2024, 5 months ago

Problem/Motivation

As a frontend developer I want to be able to resolve all types of routes from Drupal, not just entity routes.

Steps to reproduce

1. Setup a site with Druxt / Decoupled Router
2. Access /router/translate-path?path=/user/login

Proposed resolution

Make a fallback/wildcard/catchall path translator service that returns data pertaining to the route.

{
  resolved: "https://8080-realityloop-starterkitd-tqhtzkxmv10.ws-us70.gitpod.io/user/login",
  isHomePath: true,
  label: "Log in",
  context: {
    _form: "\Drupal\user\Form\UserLoginForm",
    _title: "Log in",
    _route: "user.login",
    _route_object: { },
    _raw_variables: { },
    _controller: "controller.form:getContentResult"
  }
}

Remaining tasks

Create a WildcardPathTranslatorSubscriber service that provides the $match_info object as context for a frontend client to consume as required.

User interface changes

N/A

API changes

Add context attribute to results.

Data model changes

Add context attribute to results.

✨ Feature request
Status

Needs review

Version

1.1

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia Deciphered

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024