Route Registration
This page is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
You can register modals with a route, making it possible to link directly to that specific modal. This also means the user can navigate back and forth in the browser history.
A modal can be registered via the UmbModalRouteRegistrationController
. The registration accepts a modal token (or extension alias).
The registration holds an instance of its UmbModalHandler
when the modal is active. The modal registration accepts 4 different callbacks:
onSetup
- called when the modal is openedonSubmit
- called when the modal is submittedonReject
- called when the modal is rejectedobserveRouteBuilder
- called when the modal route changes. Use the given route builder to build a route to open the modal
Additional features of the route Registration:
Adds unique parts to the path.
A modal registered in a dashboard can be setup in few steps
A modal registered in a property editor needs to become specific for the property and the variant of that property.
Builds some data for the setup.
Rejects a modal by returning false in setup.
Uses a parameter as part of the setup to determine the data going to the modal.
Modal registration for UI as part of a Property Editor
When configuring a routed modal from a Property Editor, it's important to be aware of some facts. Those facts are that the Property Editor shares the same URL path as other Property Editors. This means we need to ensure the registration is unique so it doesn't collide with other Property Editors. To do so we will make use of the Property Alias and the Variant ID.
Generate the URL to a Modal Route Registration
The Modal registration has an option to retrieve a URL Builder. This is a function that can be used to generate a URL to a modal:
The modalLink
from above could look like this: /umbraco/backoffice/my/location/modal/Our.Modal.SomethingPicker/my-input-alias
Notice the Property Editor registration will add the property alias and variant ID to the URL, so it becomes:
/umbraco/backoffice/my/location/modal/Our.Modal.SomethingPicker/my-property-alias/en-us/my-input-alias
Last updated