ElementorexCms.Renderer.Context (ElementorexCms v0.2.0)

Copy Markdown View Source

What a block knows about where it is rendered:

  • mode - :public (your site) or :editor (the canvas)
  • registry - the ElementorexCms.Registry in use
  • data - whatever the host passed (data={%{brand: @brand}}), for blocks that depend on the page
  • depth - nesting level of the node
  • sources - the ElementorexCms.Sources of dynamic content
  • item - the current item of dynamic content, or nil: %{source: source, record: record, index: index, copy: copy?}. index is its position in a loop (0 for the first) and copy is true on the canvas for the repetitions after the first one, which are shown but not edited
  • loops - how many loops the node is in
  • params - the query params of the page (string keys): loops read their page, search, sort and filters in theirs (catalog[page])
  • doc - the document being rendered (when known): filter forms find the loop grid they filter in it
  • form - inside a filter form, what its fields need (see ElementorexCms.Filters)

Summary

Types

t()

@type t() :: %ElementorexCms.Renderer.Context{
  data: map(),
  depth: non_neg_integer(),
  doc: map() | nil,
  form: map() | nil,
  item: map() | nil,
  loops: non_neg_integer(),
  mode: :public | :editor,
  params: map(),
  registry: ElementorexCms.Registry.t(),
  sources: ElementorexCms.Sources.t() | nil
}