Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
klevron committed Dec 28, 2014
1 parent f550d16 commit ec94384
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
4 changes: 4 additions & 0 deletions JsTreeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class JsTreeAsset extends AssetBundle

public $sourcePath = '@bower/jstree';

public $depends = [
'iutbay\yii2fontawesome\FontAwesomeAsset',
];

public function init()
{
parent::init();
Expand Down
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,55 @@ or add
"iutbay/yii2-jstree" : "*"
```

to the require section of your application's `composer.json` file.
to the require section of your application's `composer.json` file.

Usage
-----

With model and ActiveForm :
```php
<?= $form->field($model, 'test')->widget(\iutbay\yii2jstree\JsTree::className(), [
'items' => [
[
'id' => 1,
'text' => 'Test 1',
'children' => [
[
'id' => 2,
'text' => 'Test 2',
],
],
],
[
'id' => 3,
'text' => 'Test 3',
'icon' => 'fa fa-file', // font awesome icon
],
],
]) ?>
```

Without model :
```php
<?= \iutbay\yii2jstree\JsTree::widget([
'name' => 'test',
'value' => '1,2',
'items' => [
[
'id' => 1,
'text' => 'Test 1',
'children' => [
[
'id' => 2,
'text' => 'Test 2',
],
],
],
[
'id' => 3,
'text' => 'Test 3',
'icon' => 'fa fa-file', // font awesome icon
],
],
]) ?>
```

0 comments on commit ec94384

Please sign in to comment.