public static function field() { return function ($attribute) { $collapse = Collapse::className(); $editor = \devgroup\jsoneditor\Jsoneditor::className(); return <<<FORMAT '<div class="field-widget-{$attribute}">'. {$editor}::widget( [ 'editorOptions' => [ 'modes' => ['code', 'form', 'text', 'tree', 'view'], // available modes 'mode' => 'tree', // current mode ], 'model' => \$model, 'attribute' => '{$attribute}', 'options' => [ 'id' => 'widget-{$attribute}', 'class' => 'form-control', ], ] ). '</div>' FORMAT; }; }
<div class="row"> <div class="col-md-6"> <?php BackendWidget::begin(['title' => Yii::t('app', 'Settings for shop section'), 'icon' => 'cogs']); ?> <?php echo $form->field($model, 'shop_host'); ?> <?php echo $form->field($model, 'shop_name'); ?> <?php echo $form->field($model, 'shop_description')->textarea(); ?> <?php echo $form->field($model, 'feed_handlers')->widget(\devgroup\jsoneditor\Jsoneditor::className()); ?> <?php echo $form->field($model, 'shop_delivery_price'); ?> <?php echo $form->field($model, 'feed_file_name'); ?> <?php echo Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Icon::show('code') . Yii::t('app', 'Create Google feed'), ['create'], ['class' => 'btn btn-primary']); ?>
<div class="wysiwyg-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'class_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'params')->widget(Jsoneditor::className()); ?> <?php echo $form->field($model, 'configuration_model')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
<?php /** @var null|\yii\base\Model $configurationModel */ /** @var \app\extensions\DefaultTheme\models\ThemeWidgets $widget */ /** @var boolean $isAjax */ /** @var \yii\web\View $this */ /** @var \app\extensions\DefaultTheme\models\ThemeActiveWidgets $model */ use kartik\widgets\ActiveForm; echo \app\widgets\Alert::widget(); $form = ActiveForm::begin(['id' => 'configure-widget-json-form', 'type' => ActiveForm::TYPE_HORIZONTAL]); echo $form->field($configurationModel, 'header'); echo $form->field($configurationModel, 'displayHeader')->checkbox(); if (!empty($widget->configuration_view)) { ?> <?php echo $this->render($widget->configuration_view, ['form' => $form, 'configurationModel' => $configurationModel, 'widget' => $widget, 'isAjax' => $isAjax, 'model' => $model]); } else { ?> <?php echo $form->field($configurationModel, 'configuration_json')->widget(\devgroup\jsoneditor\Jsoneditor::className()); } echo \app\backend\components\Helper::saveButtons($model, 'index', 'configure-json', $isAjax); ActiveForm::end();
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6"> <?php $form = ActiveForm::begin(); ?> <?php BackendWidget::begin(['icon' => 'usd', 'title' => Yii::t('app', 'Payment Type'), 'footer' => $this->blocks['submit']]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'class')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'params')->widget(\devgroup\jsoneditor\Jsoneditor::className(), ['editorOptions' => ['modes' => ['code', 'tree'], 'mode' => 'tree', 'editable' => new \yii\web\JsExpression('function(node) { return { field : false, value : true }; } ')]]); ?> <?php echo $form->field($model, 'logo')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'commission')->textInput(); ?> <?php echo $form->field($model, 'active')->widget(\kartik\widgets\SwitchInput::className());
</div> </div> <?php } ?> <?php Box::end(); ?> <?php Box::begin(['title' => Yii::t('kvtree', Yii::t('kvtree', 'Advanced')), 'collapse' => true, 'collapse_remember' => false, 'collapseDefault' => true]); ?> <div class="row"> <div class="col-xs-12"> <?php echo $form->field($node, 'request_params', ['addon' => ['prepend' => ['content' => Inflector::titleize('request_params')]]])->widget(\devgroup\jsoneditor\Jsoneditor::className(), ['model' => $node, 'attribute' => 'request_params'])->label(false); ?> </div> </div> <?php Box::end(); ?> <?php } } else { ?> <div class="row"> <div class="col-sm-6"> <?php echo Html::activeHiddenInput($node, $iconTypeAttribute); ?>
*/ use app\backend\widgets\BackendWidget; use kartik\helpers\Html; use kartik\icons\Icon; $this->title = Yii::t('app', 'Update messages "{alias}"', ['alias' => $alias]); $this->params['breadcrumbs'] = [['label' => Yii::t('app', 'I18n'), 'url' => '/backend/i18n'], $this->title]; ?> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <?php echo Html::beginForm(); ?> <?php BackendWidget::begin(['icon' => 'language', 'title' => $this->title, 'footer' => Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary'])]); ?> <?php echo \devgroup\jsoneditor\Jsoneditor::widget(['editorOptions' => ['modes' => ['tree']], 'name' => 'messages', 'options' => ['style' => 'height: 600px'], 'value' => $messages]); ?> <div> <?php echo Html::checkbox('ksort', Yii::$app->request->cookies->getValue('sortMessages'), ['id' => 'ksort']); ?> <?php echo Html::label(Yii::t('app', 'Sort by source messages'), 'ksort'); ?> </div> <?php BackendWidget::end(); ?> <?php echo Html::endForm(); ?>