Feature/Proposal: Added support for element factory for modal manager context #1507
+148
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses umbraco/Umbraco-CMS#16677 to be able to support custom "modal host" elements. That is not the content of the modal but the modal it self. I figured I'll implement something to show how I think it could be done.
I also added a working example in the
/examples/
folder.Description
This PR will make it possible for extensions (and the core) to extend
UUIModalElement
to create a custom modal element.This is made possible by the added
elementFactory
parameter that is called bymodal.element
when the modal is created.Types of changes
Motivation and context
This makes it possible to extensions and core developers to create other types of modals while still reusing the foundation with the core Modal Manager Context, routing etc.
How to test?
There is a example included in the PR, to try it out you would need to find a way to open the modal.
In some element add code like this:
Let me know what you think and if there is any adjustments you would like me to make.
Cheers!