Card / Window Modals
Card modals display other pages as their content.
This element is based on the vue js modal module.
Card Modals are a special type of modal that show the contents of another page as their contents.
They are opened with an showCardModal
action and hidden with a hideCardModal
action.
Options
The following items can exist in the options object for the showCardModal
action. Either slug
or idForm
must be present to identify the page loaded in the card modal. See source docs for a complete list of additional parameters.
Option Key | Type | Description / Purpose |
---|---|---|
| string | Add a name to the card window. If not set, it will default to "modal". You can use the modal to target the window for other actions. |
| boolean | defaults true. If false, you will not be able to click outside of the modal to close it. |
| boolean | defines a CSS selector for an element that should be allowed to drag the entire model if clicked on by the user |
| string | pixel or % value to define the height of the modal |
| string | (optional - instead of slug) UUID of the page to show in the card |
| object | if set, this data will be used for the page data model. If an |
| array | Array of actions to be run when the card window is closed. This and the `onClosed` is useful if you want to run actions when a user clicks outside the modal without explicitly clicking a button. |
| array | Array of actions run after the modal has been closed. |
| object | Data passed to FMS as if it were a query param (more below) |
| boolean | defaults false. If true, the model can be resized by the user |
| boolean | defaults true. If false, the modal's content will be fixed in view (user cannot scroll down the page) |
| string | Must match a site navigation slug of the page to show in the card |
| string | Classes that will be applied to to modal window wrapper |
| string | pixel or % value to define the width of the modal |
Changing paths / page contents, use a path
action with added windowName
key to target the correct window, in this case the name of this modal.
Passing Parameters
Often you need to pass some params to the modal from the parent page. These fall within situations, with or without the onFormRequest
hook enabled.
With onFormRequest
enabled
onFormRequest
enabledWhen called from another (parent) page. If you need onFormRequest
params, use the query
key as you would with other pages and read via the $$BF_Query
global in your hook script.
Without onFormRequest
enabled
onFormRequest
enabledWhen showing a modal and you don't need to call a server hook script you can still pass data to modal several ways.
Via the
model
key. data in the key will appear in themodel
for the modal. This is useful when you want to edit some detail information that the parent form already has.Via the
app
object. By setting a key within theapp
object, and then later reading that when the form loads, you can pass anything back and forth between parent and modal.
Last updated