PHP code example of dmstr / yii2-json-editor
1. Go to this page and download the library: Download dmstr/yii2-json-editor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dmstr / yii2-json-editor example snippets
$example_schema = [
'title' => 'Example JSON form',
'type' => 'object',
'properties' => [
'name' => [
'title' => 'Full Name',
'type' => 'string',
'minLength' => 5
],
'date' => [
'title' => 'Date',
'type' => 'string',
'format' => 'date',
],
],
];
$form->field($model, 'example_field')->widget(JsonEditorWidget::className(), [
'schema' => $example_schema,
'clientOptions' => [
'theme' => 'bootstrap3',
'disable_collapse' => true,
'disable_edit_json' => true,
'disable_properties' => true,
'no_additional_properties' => true,
],
]);
$form->field($model, 'example_field')->widget(JsonEditorWidget::className(), [
'schema' => $example_schema,
'registerCKEditorAsset' => true, // CKEditorAsset will be registered (default true)
'registerJoditAsset' => true, // JoditAsset will be registered (default false)
'registerSceditorAsset' => true, // SceditorAsset will be registered (default false)
'registerSimpleMDEAsset' => true, // SimpleMDEAsset will be registered (default false)
'clientOptions' => [
'theme' => 'bootstrap3',
]
]);
JsonEditorPluginsAsset::register($this);