2017 © Pedro PelĂĄez
 

yii2-extension yii2-json-form

The JSON form view widget for yii2

image

tonisormisson/yii2-json-form

The JSON form view widget for yii2

  • Friday, June 22, 2018
  • by TonisOrmisson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 750 % Grown

The README.md

Example usage

<?php 
use tonisormisson\jsonform\JsonForm;

$jsonData = '{"username":"admin","password":"password"}';
$variables = [
    'username'=>[
        'label' => Yii::t('app','Username'),
    ],
    'password'=>[
        'label' => Yii::t('app','Password'),
        'type' => JsonForm::TYPE_PASSWORD,
    ],
];

echo JsonForm::widget([
    'id' => 'my-id',
    'json' => $jsonData,
    'jsonFieldId' => 'my-credentials-input-field',
    'variables' => $variables,
    'labels' => false,
]);

// the filed where the changed json will be stored
// hide this !!
echo Html::textarea('my-credentials-input-field','', ['id' => 'my-credentials-input-field']);

Output of example above:

alt text, (*1)

Non keyed version

<?php 
use tonisormisson\jsonform\JsonForm;

$jsonData = '["foo", "bar", "bazinga"]';

echo JsonForm::widget([
    'id' => 'my-id',
    'json' => $jsonData,
    'jsonFieldId' => 'my-credentials-input-field',
    'isKeyed' => false,
]);

// the filed where the changed json will be stored
// hide this !!
echo Html::textarea('my-credentials-input-field','', ['id' => 'my-credentials-input-field']);

alt text, (*2)

Example usage Select2


// ######################### example 3 select $jsonData = '{"select2":3}'; $variables = [ 'select2'=>[ 'label' => Yii::t('app','A select 2 example'), 'type' => JsonForm::TYPE_SELECT2, 'select' => [ 1 => "one", 2 => "two", 3 => "three" ], 'options' => ['placeholder' => 'Select a number ...'], 'pluginOptions' => [ 'allowClear' => true ] ], ]; echo JsonForm::widget([ 'id' => 'my-id-3', 'json' => $jsonData, 'jsonFieldId' => 'my-credentials-input-field-3', 'variables' => $variables, ]); echo Html::textarea('my-credentials-input-field-3','', ['id' => 'my-credentials-input-field-3']);

alt text, (*3)

The Versions

14/11 2017
01/08 2017
10/04 2017
07/04 2017
04/04 2017
01/04 2017

1.1.1

1.1.1.0

The JSON form view widget for yii2

  Sources   Download

The Requires

 

yii2 data andmemasin pivot-table

13/03 2017

1.1.0

1.1.0.0

The JSON form view widget for yii2

  Sources   Download

The Requires

 

yii2 data andmemasin pivot-table

07/03 2017

1.0.0

1.0.0.0

The JSON form view widget for yii2

  Sources   Download

The Requires

 

yii2 data andmemasin pivot-table