slavkovrn / yii2-jsoneditor
Yii2 JsonEditor widget uses Json Editor plugin for jQuery
Installs: 940
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0
This package is auto-updated.
Last update: 2024-11-26 03:10:53 UTC
README
The extension uses Json Editor plugin by Author Jadesoul http://jadesoul.org for jQuery and makes user interface for changing json values.
Installation
The preferred way to install this extension is through composer.
Either run:
composer require slavkovrn/yii2-jsoneditor
or add
"slavkovrn/yii2-jsoneditor": "*"
to the require section of your composer.json
file.
Usage
Set link to extension in your view:
<?php use slavkovrn\jsoneditor\JsonEditorWidget; use yii\widgets\ActiveForm; use yii\helpers\Html; ?> <?php $ form = ActiveForm::begin(); ?> <?= $form->field($model, 'username')->widget(JsonEditorWidget::class,[ 'rootNodeName' => 'root1', ]) ?> <?= $form->field($model, 'email')->widget(JsonEditorWidget::class,[ 'rootNodeName' => 'root2', ]) ?> <div class="form-group"> <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?> </div> <?php ActiveForm::end(); ?>