mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-20 05:29:29 +00:00
JSON-Forms
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* JSONEditor widget
|
||||
*/
|
||||
class jsoneditor_widget extends Widget
|
||||
{
|
||||
public function display($data)
|
||||
{
|
||||
// set default values if needed
|
||||
if (! isset($data['vareditor']))
|
||||
$data['vareditor'] = 'jsoneditor';
|
||||
if (! isset($data['style']))
|
||||
$data['style'] = 'width: 500px; height: 400px;';
|
||||
if (! isset($data['id']))
|
||||
$data['id'] = 'jsoneditor';
|
||||
if (! isset($data['mode']))
|
||||
$data['mode'] = 'code';
|
||||
if (! isset($data['modes']))
|
||||
$data['modes'] = "'code', 'tree', 'form'";// allowed modes
|
||||
if (! isset($data['json']))
|
||||
$data['json'] = '{
|
||||
"array": [1, 2, 3],
|
||||
"boolean": true,
|
||||
"null": null,
|
||||
"number": 123,
|
||||
"object": {"a": "b", "c": "d"},
|
||||
"string": "Hello FH-Complete"
|
||||
}';
|
||||
$this->view('widgets/jsoneditor', $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user