class JsonForm
Processes forms using configuration stored in a JSON file which specifies database columns, their HTML input fields,
and validation rules.
A generic implementation which should work for most cases is found in ManagedAdminController::_getEditForm
(generates the form) and Controller::saveJsonData (saves the POST submission) Functions
Name | Visibility | Description |
argReplace | private (static) | Replace magic strings in "args" arrays with various metadata values |
autofillOptionDefaults | public (static) | Determine the auto-generated default values for an autofill-list |
changeFieldRequired | protected (static) | Modify a JSON form config to change the 'required' status of a particular field |
collateData | public (static) | Collates POST data using specified config options |
collateFieldData | protected (static) | Collates a single field's $_POST data for INSERT/UPDATE queries, and performs validation |
expandItemDefns | public (static) | Expands item definitions for a field pulled from JSON |
flattenGroups | public (static) | Extract field defns from a list (which may include groups) |
loadAutofillListData | public (static) | Loads autofill_list data for use on a view |
loadMultiEditData | public (static) | Loads multiedit data for use on a view |
makeOptional | public (static) | Modify a JSON form config to make a particular field optional |
makeRequired | public (static) | Modify a JSON form config to make a particular field required |
renderField | public (static) | Renders the input for a field definition pulled from a JSON file |
renderTabItem | public (static) | Render a tab item, which may be a field, heading, html block, etc |
setParameterForColumns | public (static) | Set a parameter for fields to be a specific value, for one or more columns |
array JsonForm::argReplace ( array $args , array $metadata );
Replace magic strings in "args" arrays with various metadata values
Replacements:
%% The current record id array JsonForm::autofillOptionDefaults ( array $auto , string $local_table_name );
Determine the auto-generated default values for an autofill-list
Defaults:
joiner_local_col Singular of local table name + '_id'
joiner_foreign_col Singular of the foreign_table option + '_id'
foreign_label_col 'name'
reorder false void JsonForm::changeFieldRequired ( array &$conf , string $field_name , bool $required );
Modify a JSON form config to change the 'required' status of a particular field
This implements JsonForm::makeOptional and JsonForm::makeRequired array JsonForm::collateData ( array $conf , string $mode , Validator $validator , int $item_id );
Collates POST data using specified config options void JsonForm::collateFieldData ( array $field_defn , string $input , array $metadata , Validator $valid , array &$data );
Collates a single field's $_POST data for INSERT/UPDATE queries, and performs validation void JsonForm::expandItemDefns ( array &$field , array $metadata );
Expands item definitions for a field pulled from JSON array JsonForm::flattenGroups ( array $items );
Extract field defns from a list (which may include groups) array JsonForm::loadAutofillListData ( array $conf , string $local_table_name , int $local_record_id , array $conditions );
Loads autofill_list data for use on a view array JsonForm::loadMultiEditData ( array $conf , string $default_link , int $record_id , array $conditions );
Loads multiedit data for use on a view void JsonForm::makeOptional ( array &$conf , string $field_name );
Modify a JSON form config to make a particular field optional void JsonForm::makeRequired ( array &$conf , string $field_name );
Modify a JSON form config to make a particular field required string JsonForm::renderField ( array $field [, string $name_prepend , array $metadata ] );
Renders the input for a field definition pulled from a JSON file html JsonForm::renderTabItem ( array $item , string $for , int $id , array $data , array $errors [, string $name_prepend ] );
Render a tab item, which may be a field, heading, html block, etc null JsonForm::setParameterForColumns ( array &$items , array $columns , string $key , string $val );
Set a parameter for fields to be a specific value, for one or more columns
|