dmitry-kulikov / Yii2 Json Editor
Licence: mit
JSON editor widget (josdejong/jsoneditor) for Yii 2.
Stars: ✭ 11
Labels
Projects that are alternatives of or similar to Yii2 Json Editor
yii2-telegram
Support chat for site based on Telegram bot
Stars: ✭ 49 (+345.45%)
Mutual labels: yii2-extension
yii2-forms
Forms CRUD - formbuilder, generator code
Stars: ✭ 32 (+190.91%)
Mutual labels: yii2-extension
yii2-blog
Simple, configurable blog module for Yii2 (post, comment, nested category, tags). + frontend, backend. + SEO! (Opengraph, Schema.org) ~~~COMING SOON V2.0~~~ Please STAR this repo
Stars: ✭ 79 (+618.18%)
Mutual labels: yii2-extension
Yii2 Gentelella
Free admin template for backend
Stars: ✭ 266 (+2318.18%)
Mutual labels: yii2-extension
filedb
ActiveRecord for static data definitions based on files
Stars: ✭ 72 (+554.55%)
Mutual labels: yii2-extension
collection
Basic collection library for Yii Framework 2.0
Stars: ✭ 29 (+163.64%)
Mutual labels: yii2-extension
Yii2 Google Maps Markers
Google Maps Markers Widget for Yii2
Stars: ✭ 16 (+45.45%)
Mutual labels: yii2-extension
yii2-firebird
Firebird connector for Yii2 framework
Stars: ✭ 23 (+109.09%)
Mutual labels: yii2-extension
yii2-sitemap
A Yii2 extension to generate sitemap files for large web-sites in console
Stars: ✭ 31 (+181.82%)
Mutual labels: yii2-extension
Yii2 Dynamicform
It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Stars: ✭ 408 (+3609.09%)
Mutual labels: yii2-extension
yii2-star-rating
Star rating widget based on jQuery Raty
Stars: ✭ 16 (+45.45%)
Mutual labels: yii2-extension
Yii2 Doc Online
An online document library used by Yii2 framework.
Stars: ✭ 22 (+100%)
Mutual labels: yii2-extension
yii2-merit
Reputation engine for Yii2 用于实现积分,等级功能的设计
Stars: ✭ 16 (+45.45%)
Mutual labels: yii2-extension
yii2-queuemanager
Yii2 Queue Manager (Analytic & Monitor)
Stars: ✭ 18 (+63.64%)
Mutual labels: yii2-extension
Yii2 C3 Chart
Yii2 wrapper for D3-based reusable chart library
Stars: ✭ 9 (-18.18%)
Mutual labels: yii2-extension
Yii2 Helpers
Collection of useful helper functions for Yii Framework 2.0
Stars: ✭ 16 (+45.45%)
Mutual labels: yii2-extension
yii2-json-editor
JSON editor widget for Yii 2.
This widget uses JSON editor josdejong/jsoneditor.
Requirements
- PHP 5.4 or later or HHVM;
- Yii framework 2.
Installation
The preferred way to install this extension is through Composer.
To install, either run
$ php composer.phar require kdn/yii2-json-editor "*"
or add
"kdn/yii2-json-editor": "*"
to the require
section of your composer.json
file.
Usage
Minimal example:
<?php
use kdn\yii2\JsonEditor;
echo JsonEditor::widget(['name' => 'editor']);
with some options:
<?php
use kdn\yii2\JsonEditor;
echo JsonEditor::widget(
[
// JSON editor options
'clientOptions' => [
'modes' => ['code', 'form', 'text', 'tree', 'view'], // available modes
'mode' => 'tree', // default mode
'onModeChange' => 'function (newMode, oldMode) {console.log(this, newMode, oldMode);}',
],
'collapseAll' => ['view'], // collapse all fields in "view" mode
'containerOptions' => ['class' => 'container'], // HTML options for JSON editor container tag
'expandAll' => ['tree', 'form'], // expand all fields in "tree" and "form" modes
'name' => 'editor', // hidden input name
'options' => ['id' => 'data'], // HTML options for hidden input
'value' => $json, // JSON which should be shown in editor
]
);
with ActiveForm and Model:
<?php
use kdn\yii2\JsonEditor;
echo $form->field($model, 'data')->widget(
JsonEditor::class,
[
'clientOptions' => ['modes' => ['code', 'tree']],
]
);
compact viewer expandable on demand:
<?php
use kdn\yii2\JsonEditor;
echo JsonEditor::widget(
[
'clientOptions' => ['mode' => 'view'],
'collapseAll' => ['view'],
'name' => 'viewer',
'value' => $json,
]
);
To get instance of JSON editor on client side you can use the following JavaScript:
var jsonEditor = window[$('#YOUR-HIDDEN-INPUT-ID').data('json-editor-name')];
jsonEditor.set({"foo": "bar"});
Please view public properties in class JsonEditor to get info about all available options, they documented comprehensively.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].