Ready-made sections the editor can insert (Templates panel).
Add your own with a module that implements this behaviour and list it in the
config (or pass templates={...} to the editor):
defmodule MyApp.EditorTemplates do
@behaviour ElementorexCms.Templates
import ElementorexCms.Builder
@impl true
def templates do
[
%{
key: "promo",
label: "Promotion",
description: "Headline, countdown and button",
icon: "megaphone",
nodes: fn -> [block("heading", %{text: "Black Friday"}), block("countdown")] end
}
]
end
end
config :elementorex_cms, templates: [MyApp.EditorTemplates]nodes is a function so every insertion gets fresh ids.
Summary
Callbacks
Templates offered by the module.
Functions
Built-in templates followed by the configured ones.
The built-in templates.
The template with key, or nil.
Types
Callbacks
@callback templates() :: [template()]
Templates offered by the module.