An unpublished working copy of a runtime MishkaCmsCore.Runtime.Layout — the Layout analogue of
MishkaCmsCore.Runtime.PageDraft.
A draft holds the same editable fields as a Layout plus:
source_layout_id— the live Layout it edits, ornilfor a brand-new draft-only layout.preview_token— an unguessable token for the shareable/_preview/layout/:tokenURL.status(:draft/:published) andapplied_at— set when the draft is published.
Publishing is explicit (:publish / :master_publish): it writes the draft's fields to the live
Layout (creating it when source_layout_id is nil, otherwise updating all but its helpers),
then marks the draft published. See MishkaCmsCore.Runtime.Resources.Changes.PublishLayoutDraft.
Layouts can be global (site_id nil, master-managed), so — unlike PageDraft — this resource
is global? true and its site_id is nullable; a draft inherits the source layout's site (nil for
a global layout). The preview-modal UI only exposes drafts/editing to users who may edit the
layout (master, or a tenant on its own non-global layout).
Summary
Types
@type t() :: %MishkaCmsCore.Runtime.LayoutDraft{ __lateral_join_source__: term(), __meta__: term(), __metadata__: term(), __order__: term(), active: term(), aggregates: term(), applied_at: term(), calculations: term(), content: term(), description: term(), example: term(), extra: term(), format: term(), helpers: term(), id: term(), inserted_at: term(), label: term(), name: term(), path: term(), permissions: term(), precompile: term(), preview_token: term(), priority: term(), resource_links: term(), seo_tags: term(), site: term(), site_id: term(), source_hash: term(), source_layout: term(), source_layout_id: term(), status: term(), template: term(), updated_at: term() }
Functions
Generate an unguessable URL-safe preview token.
Validates that the keys in the provided input are valid for at least one action on the resource.
Raises a KeyError error at compile time if not. This exists because generally a struct should only ever
be created by Ash as a result of a successful action. You should not be creating records manually in code,
e.g %MyResource{value: 1, value: 2}. Generally that is fine, but often with embedded resources it is nice
to be able to validate the keys that are being provided, e.g
Resource
|> Ash.Changeset.for_create(:create, %{embedded: EmbeddedResource.input(foo: 1, bar: 2)})
|> Ash.create()
Same as input/1, except restricts the keys to values accepted by the action provided.