# `MishkaCmsCore.Runtime.PageBuilder.Helpers`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/page_builder/_helpers.ex#L5)

Saves a builder section through its resource's own actions.

# `save_section`

Persists a builder section (page / layout / error page) by delegating to the resource's
own `create`/`update` actions, so the resource's `guardedstruct` validation and field
policies stay the single source of truth (no second schema on the builder side). Create
vs update is chosen by an `"id"` in `fields`; master vs tenant by the actor's `site_id`
(a master has `site_id: nil` and uses the bypass `:master_*` actions). `fetch` reads the
record for an update. Returns the resource's own `{:ok, record}` / `{:error, changeset}`.

A field whose value is a one-argument function is one that has to be WORKED OUT FROM THE
ROW BEING WRITTEN — an error page's `error_pages` is the whole list with one entry
replaced — and it is resolved here, against the record this function has just read and is
about to update, rather than by the caller against whatever copy it happens to hold. See
`MishkaCmsCore.Runtime.PageBuilder.Section.save_fields/3`, which is what builds them.

Pass `typed: true` when the markup was typed by hand rather than generated from the tree — the
recovery screen's box. The write is then code, as from any form, which a deployment that turned
code off refuses.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
