backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

[UX] Make layouts aware of path aliases #3749

Open jenlampton opened 5 years ago

jenlampton commented 5 years ago

If you attempt to create a menu entry for a node at /about, you can enter about into the menu UI, and it knows that's an alias. The menu entry it saves is actually for the system path, at node/2.

Could we do something similar for layouts? Many people who are new to backdrop try to put in an aliased path for the layout instead of the system path. Would it be possible check the path table, and do a switcheroo for them if we find a match?

For example, if they entered about we could

This might have to be done with ajax as soon as they tab out of that field, since the contexts in the next question need to be added dynamically too...

docwilmot commented 5 years ago

bold path examples are what you actually type into layout configuration path field (including the literal % wildcard symbol.

  1. foo
    • will load assigned layout
  2. entity/%
    • will load assigned layout; loads entity context
  3. entity/%/%
    • will load entity context for first wild-card
    • node/2 will load assigned layout
    • node/2/everything will load assigned layout
  4. afoo (this is an alias for system path /existing/path)
    • will error "That path is currently assigned to be an alias for "existing/path". Delete the alias first, then save this layout."
  5. afoo/% (this matches an alias pattern, for example: nodes are being matched to afoo/NODE-TITLE)
    • afoo/foo will NOT load the assigned layout (even if an alias called afoo/foo already exists
  6. foo/% (no hook_menu() entry foo/% exists)
    • foo/bar will load assigned layout
    • foo/everything will load assigned layout
    • foo will 404
  7. foo/bar/% (no hook_menu() entry foo/bar/% exists)
    • foo/bar/everything will load assigned layout
    • foo/bar will 404
    • foo will 404
  8. bar/% (a hook_menu() entry for bar exists)
    • bar/foo will NOT load the assigned layout
    • bar will NOT 404
  9. bar/% (a hook_menu() entry for bar/% exists)
    • bar/foo will NOT load the assigned layout
    • bar will NOT 404
  10. bar/anotherbar/% (a hook_menu() entry for bar/anotherbar/% exists)
    • bar/anotherbar/% will NOT load the assigned layout
    • bar/anotherbar will NOT 404
    • bar will NOT 404
  11. foo/bar (full actual strings, no menu entry exists)
    • will load assigned layout
    • foo will 404
  12. foo/bar/bat (full actual strings, no menu entry exists)
    • will load assigned layout
    • foo/bar will 404
    • foo will 404

What we want to happen: @jenlampton @klonos @laryn ?

@quicksketch does the above look about right?