Skip to content

v0.4.0

Choose a tag to compare

@etus-ephraitech etus-ephraitech released this 28 Oct 21:23
· 7 commits to master since this release

Showing stored data, a forms helper, and FormSchema::describe() as groundwork for visual
builders. No breaking changes.

Added

  • Form::present($data) turns stored data, such as a saved submission, into readable rows:
    field labels, option labels instead of values (including groups and provider options),
    Yes/No for checkboxes and lists for multi-value fields. Values no longer among the options
    are shown as stored. Passwords, buttons and uploads are never included.
    Form::renderPresented($data) renders them with the new presented theme view.
  • Contracts\PresentableFieldInterface (isPresentable(), presentValue()), implemented by
    every field; custom fields can override presentValue(), for example to format amounts.
  • Config $presentYes, $presentNo, $presentEmpty and theme classes presented,
    presented_label, presented_value, presented_empty.
  • A forms helper (helper('forms')) with forms_load(), forms_check() and
    forms_present(). Functions are prefixed forms_ so they never clash with CodeIgniter's
    form helper.
  • FormSchema::describe($policy) describes what a schema may contain under a policy, as
    JSON-ready data: every allowed field type with its label, accepted keys, the kind of value
    each key takes and a one-line explanation, which keys are required (requires) or cannot be
    combined (exclusive), plus the allowed rules with their parameter kinds, attributes,
    option providers, upload types, size limits and forbidden names. Groundwork for visual
    builders and admin help pages; a test loads every described key through the loader under
    each policy, so the description and the loader cannot disagree.
  • SchemaLoader::keysFor() (the loader's own key lists, shared with describe()) and
    SchemaPolicy::getRules(), getAttributes(), getForbiddenNames(), getLimits().