AshFormBuilder.Info
(AshFormBuilder v0.2.0)
View Source
Introspection helpers for AshFormBuilder DSL data.
Works on both compiled resource modules and in-progress dsl_state maps
(the latter is used inside Spark transformers).
Auto-inference
effective_fields/1 and effective_entities/1 are the preferred runtime
accessors. They merge auto-inferred fields (derived from the action's
accept list via AshFormBuilder.TypeInference) with any explicit DSL
overrides. Explicit declarations win on a per-field basis.
The lower-level form_fields/1 and form_entities/1 return only the
explicitly declared DSL entities — useful inside transformers where
Ash.Resource.Info is not yet available.
Summary
Functions
Builds the AshPhoenix.Form :forms keyword list from the nested entities.
Returns all effective form entities: effective_fields/1 followed by
the NestedForm structs declared in the DSL.
Returns the effective list of Field structs for the form action.
form DSL entities
Returns the configured :action option, or nil if no form block.
The Ash action this form targets, e.g. :create or :update.
Enable creatable combobox for all many_to_many relationships. Individual fields can override this.
Enable creatable combobox for all many_to_many relationships. Individual fields can override this.
Default action to use for creating new items in creatable comboboxes.
Default action to use for creating new items in creatable comboboxes.
All DSL entities in declaration order (mix of Field and NestedForm structs).
Custom ordering for fields. Fields listed first appear first. Fields not listed appear after in default order.
Custom ordering for fields. Fields listed first appear first. Fields not listed appear after in default order.
Only the top-level Field structs declared in the DSL.
HTML id attribute for the <form> element.
HTML id attribute for the <form> element.
Returns the configured :form_id, or nil.
Fields to exclude from auto-inference. Use this to hide fields without writing full field blocks.
Fields to exclude from auto-inference. Use this to hide fields without writing full field blocks.
Whether to include :inserted_at and :updated_at fields. Set to true if you need timestamp inputs.
Whether to include :inserted_at and :updated_at fields. Set to true if you need timestamp inputs.
Override the auto-generated helper module name (default: Resource.Form).
Override the auto-generated helper module name (default: Resource.Form).
Returns the override :module option, or nil (generator uses Resource.Form by default).
Only the NestedForm structs declared in the DSL.
form DSL options
Returns the configured :submit_label, defaulting to "Submit".
Label for the submit button.
Returns the configured :wrapper_class, defaulting to "space-y-4".
CSS class applied to the fields wrapper <div>.
True when the resource has a form block with an action set.
Functions
Builds the AshPhoenix.Form :forms keyword list from the nested entities.
Used by the generated Resource.Form.for_action/2 helper so callers never
have to hand-write the nested form configuration.
Returns all effective form entities: effective_fields/1 followed by
the NestedForm structs declared in the DSL.
This is the preferred accessor for rendering — it gives a complete, ordered list of what to render without requiring explicit field declarations.
Only call this on a compiled resource module.
@spec effective_fields(module()) :: [AshFormBuilder.Field.t()]
Returns the effective list of Field structs for the form action.
Fields are produced by auto-inferring from the action's accept list, then
applying explicit DSL declarations as overrides (explicit wins per field name).
Any DSL field whose name is not in the inferred list is appended at the end,
allowing you to add argument fields not in accept.
Only call this on a compiled resource module, not on a dsl_state map.
form DSL entities
Returns the configured :action option, or nil if no form block.
The Ash action this form targets, e.g. :create or :update.
Enable creatable combobox for all many_to_many relationships. Individual fields can override this.
Enable creatable combobox for all many_to_many relationships. Individual fields can override this.
Default action to use for creating new items in creatable comboboxes.
Default action to use for creating new items in creatable comboboxes.
All DSL entities in declaration order (mix of Field and NestedForm structs).
Custom ordering for fields. Fields listed first appear first. Fields not listed appear after in default order.
Custom ordering for fields. Fields listed first appear first. Fields not listed appear after in default order.
Only the top-level Field structs declared in the DSL.
HTML id attribute for the <form> element.
HTML id attribute for the <form> element.
Returns the configured :form_id, or nil.
Fields to exclude from auto-inference. Use this to hide fields without writing full field blocks.
Fields to exclude from auto-inference. Use this to hide fields without writing full field blocks.
Whether to include :inserted_at and :updated_at fields. Set to true if you need timestamp inputs.
Whether to include :inserted_at and :updated_at fields. Set to true if you need timestamp inputs.
Override the auto-generated helper module name (default: Resource.Form).
Override the auto-generated helper module name (default: Resource.Form).
Returns the override :module option, or nil (generator uses Resource.Form by default).
Only the NestedForm structs declared in the DSL.
form DSL options
Returns a map containing the and any configured or default values.
Returns the configured :submit_label, defaulting to "Submit".
Label for the submit button.
Returns the configured :wrapper_class, defaulting to "space-y-4".
CSS class applied to the fields wrapper <div>.
True when the resource has a form block with an action set.