View Source Bonfire.UI.Common.SmartInputModule behaviour (Bonfire v0.9.10-classic-beta.169)
Find a smart input module via the object type(s) it can create, or vice versa. Backed by a global cache of known smart input modules.
To add a module to this list, you should declare @behaviour Bonfire.UI.Common.SmartInputModule
in it and define a smart_input_module/0
function which returns a list of object types that it can create.
Example:
@behaviour Bonfire.UI.Common.SmartInputModule
def smart_input_module, do: [:page, Bonfire.Pages.Page]
You can then open the smart input composer / object creator using that declared type, for example:
<Bonfire.UI.Common.SmartInputButtonLive
create_object_type={:page}
prompt={l("New page")}
icon="mdi:pencil"
/>
Summary
Callbacks
Declares a smart input module
Functions
Callback implementation for Bonfire.Common.ExtensionBehaviour.modules/0
.
Returns a list of smart input modules and the object type(s) it can create, and vice versa.
Callbacks
@callback smart_input_module() :: any()
Declares a smart input module
Functions
@spec modules() :: [atom()]
Callback implementation for Bonfire.Common.ExtensionBehaviour.modules/0
.
Returns a list of smart input modules and the object type(s) it can create, and vice versa.