AshFormBuilder.Info
(AshFormBuilder v0.4.0)
View Source
Introspection helpers for AshFormBuilder DSL data.
As of v0.4 the DSL supports one form declaration per Ash action. All accessors take the action atom so callers can pick the right form config.
Works on both compiled resource modules and in-progress dsl_state
maps (the latter is used inside Spark transformers).
Auto-inference
effective_fields/2 and effective_entities/2 are the preferred
runtime accessors. They merge auto-inferred fields (derived from the
action's accept list via AshFormBuilder.Infer) with any explicit
DSL overrides. Explicit declarations win on a per-field basis.
The lower-level form_fields/2 and form_entities/2 return only the
explicitly declared DSL entities.
Summary
Functions
Builds the AshPhoenix.Form :forms keyword list for the given action.
Returns all effective form entities: effective_fields/2 followed by
the NestedForm structs declared for the action.
Returns the effective list of Field structs for the given action.
Accent color atom for the action's form (default :indigo).
Fetch the FormConfig for the given action, or nil.
All DSL entities (fields + nested forms) for the given action.
Only the top-level Field structs declared for the given action.
HTML id for the given action's form, or nil.
List of fields/nested-form names to suppress, declared via ignore_fields on the form.
Override module name for the generated form helper, or nil.
Only the NestedForm structs declared for the given action.
Submit label for the given action's form, defaults to "Submit".
Theme module for the action's form.
Transition intensity for the action's form (:none | :subtle | :smooth).
Wrapper CSS class for the given action's form.
All declared form configs in the order written.
True when the resource declares a form for the given action.
Functions
Builds the AshPhoenix.Form :forms keyword list for the given action.
Returns all effective form entities: effective_fields/2 followed by
the NestedForm structs declared for the action.
For zero-config use, a bare nested :foo do end block (no field
children) auto-inflates with fields inferred from the destination
resource's create action — so users get a fully wired sub-form for
has_many relationships without writing any field declarations.
@spec effective_fields(module(), atom()) :: [AshFormBuilder.Field.t()]
Returns the effective list of Field structs for the given action.
Fields are produced by auto-inferring from the action's accept list
(falling back to writable attributes when accept is empty), then
applying explicit DSL declarations as overrides.
Any DSL field whose name is not in the inferred list is appended at
the end, allowing argument fields not in accept.
Accent color atom for the action's form (default :indigo).
@spec form_config(module() | map(), atom()) :: AshFormBuilder.FormConfig.t() | nil
Fetch the FormConfig for the given action, or nil.
All DSL entities (fields + nested forms) for the given action.
Only the top-level Field structs declared for the given action.
HTML id for the given action's form, or nil.
List of fields/nested-form names to suppress, declared via ignore_fields on the form.
Override module name for the generated form helper, or nil.
Only the NestedForm structs declared for the given action.
Submit label for the given action's form, defaults to "Submit".
Theme module for the action's form.
Resolves in this order:
- The form's
theme:DSL value (atom or module — looked up inAshFormBuilder.Themes). - The
:themeApplication env (atom or module — same lookup). AshFormBuilder.Themes.Default.
Transition intensity for the action's form (:none | :subtle | :smooth).
Wrapper CSS class for the given action's form.
@spec forms(module() | map()) :: [AshFormBuilder.FormConfig.t()]
All declared form configs in the order written.
True when the resource declares a form for the given action.