The sources of dynamic content a document can use (see
ElementorexCms.Source), like ElementorexCms.Registry is for blocks.
default/0 reads the config:
config :elementorex_cms,
sources: [
# an Ecto schema: every field, read from the schema
MyApp.Catalog.Product,
# a module (use ElementorexCms.Source.Ecto or the behaviour)
MyAppWeb.Sources.Posts,
# the Ecto adapter with options
{ElementorexCms.Source.Ecto, schema: MyApp.Events.Event, path: "/events/:id"}
]Pass the same sources to the editor and to ElementorexCms.Components.document/1
(sources={...}) to use others than the configured ones.
Summary
Functions
The configured sources (config :elementorex_cms, sources: [...]).
Whether there are no sources.
The source with key, or nil.
The source a record comes from: the one whose Ecto schema is the record's
struct (see ElementorexCms.Source.Ecto), or nil.
The sources in the order they were given.
Builds the sources from a list of source modules, Ecto schemas or
{adapter, opts} tuples (see ElementorexCms.Source.new/1). nil gives
default/0; a later source with the same key replaces an earlier one.
Types
@type t() :: %ElementorexCms.Sources{ order: [String.t()], sources: %{required(String.t()) => ElementorexCms.Source.t()} }
Functions
@spec default() :: t()
The configured sources (config :elementorex_cms, sources: [...]).
Whether there are no sources.
@spec fetch(t() | nil, term()) :: ElementorexCms.Source.t() | nil
The source with key, or nil.
@spec for_record(t() | nil, term()) :: ElementorexCms.Source.t() | nil
The source a record comes from: the one whose Ecto schema is the record's
struct (see ElementorexCms.Source.Ecto), or nil.
@spec list(t() | nil) :: [ElementorexCms.Source.t()]
The sources in the order they were given.
Builds the sources from a list of source modules, Ecto schemas or
{adapter, opts} tuples (see ElementorexCms.Source.new/1). nil gives
default/0; a later source with the same key replaces an earlier one.