Download the PHP package e0ipso/schema-forms without Composer
On this page you can find all versions of the php package e0ipso/schema-forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download e0ipso/schema-forms
More information about e0ipso/schema-forms
Files in e0ipso/schema-forms
Package schema-forms
Short Description Creates form definitions from JSON Schema property definitions and display configuration.
License GPL-2.0-or-later
Informations about the package schema-forms
Schema Forms
Schema forms is a project that aims to generate form structures for the different PHP frameworks based on the data definitions in JSON Schema.
Frameworks supported:
- Drupal.
Usage
Given the following JSON Schema defining the different properties of a user object.
And the following UI JSON Schema refining the form generation process:
Execute this PHP code:
UI Schema Data
Based on the shape of the data described by the JSON Schema, this library can generate a form. However, there are multiple ways to generate a form for the same shape of data. The UI schema data allows you to control the form elements and inputs that will collect the data in the appropriate way.
Supported UI controls are:
-
$ui_form_data['ui:title']
Controls the label associated to the input element. Defaults to the element's
title
property in the JSON Schema. -
$ui_form_data['ui:help']
Adds a hint to the input element. Defaults to the element's
description
property in the JSON Schema. -
$ui_form_data['ui:placeholder']
Adds a placeholder text to the input.
-
$ui_form_data['ui:widget']
Lets you use al alternative input element. For instance, it lets you use
<select>
instead of<input type="radio">
, or use<input type="hidden">
, among others. -
$ui_form_data['ui:enabled']
If 0 the form element will be rendered as non-interactive.
-
$ui_form_data['ui:visible']
If 0 the form element will not be rendered.
-
$ui_form_data['ui:enum']
Lets you define how the options for selects and radios are populated. By default, the enum information in the schema defines the options. This might not be enough, or even possible.
$ui_form_data['ui:enum']['labels']['mappings']
An object defining the label for each key. Ex:
{"uuid1": "Super duper product"}
.
All versions of schema-forms with dependencies
ext-json Version *
e0ipso/shaper Version ^1.2
justinrainbow/json-schema Version ^5.2
symfony/polyfill-php81 Version ^1.26