v3 style route resolution

Created on 21 November 2022, over 1 year ago
Updated 11 April 2023, about 1 year ago

Problem/Motivation

Similar to v3 graphql, route() could return an interface Route

Then we have 3 types
- RouteInternal
- RouteExternal
- RouteRedirect

Each one of those is super useful for implementation by a frontend developer.

Example might be:
Frontend dev has a wildcard router.
User clicks link.
Router fetches '/test'/
Test returns from Drupal as an internal redirect
Frontend can get what it needs to redirect the user via transition rather than window.location.

Proposed resolution

Unsure where to put this code.

It doesnt feel like it follows the core principal of this module.
Its a sub module or side project at best. I'll create the issue here anyway for discussion.

Remaining tasks

Decide where and if this lives here.
If its all-round usefulness is core, then how this integrates with DataManager is unknown.

User interface changes

None

API changes

Addition of route()

Data model changes

Adds 'route' field to Link

interface Route {
  url: String!
  internal: Boolean!
}

type RouteInternal implements Route {
  url: String!
  internal: Boolean!
  entity: RouteUnion
}

type RouteExternal implements Route {
  url: String!
  internal: Boolean!
}

type RouteRedirect implements Route {
  url: String!
  internal: Boolean!
  status: Int!
  redirect: Boolean!
}
✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia AlMunnings Melbourne

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

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