loveorigami / yii2-jsoneditor
Yii2 jsoneditor widget
Installs: 3 873
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- bower-asset/jsoneditor: ~3.1
- yiisoft/yii2: 2.0.*
Requires (Dev)
- yiisoft/yii2-debug: 2.0.*
This package is auto-updated.
Last update: 2024-11-23 02:07:41 UTC
README
This extension provides the Jsoneditor integration for the Yii2 framework. This package is fork from [DevGroup-ru/yii2-jsoneditor] (https://github.com/DevGroup-ru/yii2-jsoneditor) with active form support, because my pull-request is not merged.
Installation
This extension requires Jsoneditor
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist loveorigami/yii2-jsoneditor "*"
or add
"loveorigami/yii2-jsoneditor": "*"
to the require section of your composer.json.
General Usage
use lo\widgets\Jsoneditor; Jsoneditor::widget( [ 'editorOptions' => [ 'modes' => ['code', 'form', 'text', 'tree', 'view'], // available modes 'mode' => 'tree', // current mode ], 'name' => 'editor', // input name. Either 'name', or 'model' and 'attribute' properties must be specified. 'options' => [], // html options ] )
or with active form as
<?= $form->field($model,'name')->widget(Jsoneditor::className(), [ 'editorOptions' => [ 'modes' => ['code', 'form', 'text', 'tree', 'view'], // available modes 'mode' => 'tree', // current mode ], ] ); ?>