public static function buildVoteOption($form, $modelOption, $isHidden = false) { $lines = []; $lines[] = '<div class="' . ($isHidden ? 'option-template hidden ' : '') . 'form-group">'; $lines[] = '<div class="vote-option row">'; $lines[] = '<div class="col-sm-11">'; $lines[] = $form->field($modelOption, ($isHidden ? '[NEW_IND]' : '[' . $modelOption->id . ']') . 'title')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput']]); $lines[] = '</div>'; $lines[] = '<div class="col-sm-1">'; $lines[] = '<button class="button-delete-option' . ($isHidden ? ' ' : '-exists') . ' btn btn-default" type="button"' . ($isHidden ? ' ' : 'data-option-id="' . $modelOption->id . '"') . '><i class="fa fa-fw fa-trash-o"></i></button>'; $lines[] = '</div>'; $lines[] = '</div>'; $lines[] = '</div>'; return join("\n", $lines); }
public function run() { if (!$this->form instanceof ActiveForm) { throw new Exception('Form must be provided'); } $options = $this->options; $model = $this->model; $attribute = $this->attribute; $form = $this->form; $className = $this->className; $initialPreview = []; $initialPreviewConfig = []; $initialPreviewThumbTag = []; if (is_array($model->{$attribute})) { foreach ($model->{$attribute} as $k => $value) { $initialPreview[] = Html::img($value->getThumbFileUrl('image', 'small')); $initialPreviewConfig[] = ['url' => Url::to(['news/gallery-delete-fake']), 'key' => $value->id]; $initialPreviewThumbTag[] = ['{TAG_CSS_NEW}' => 'hide', '{TAG_CSS_INIT}' => '', '{CUSTOM_TAG_NEW}' => '', '{CUSTOM_TAG_INIT}' => '' . $form->field($value, '[' . $value->id . ']image_text')->label(Yii::t('b/radiata/common', 'Image text'))->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput', 'additionalCssClasses' => 'kv-input kv-new form-control input-sm']])]; } } $newsGallery = new $className(); $fieldName = (new \ReflectionClass($className))->getShortName(); return $this->render('GalleryInput', compact('form', 'options', 'model', 'attribute', 'initialPreview', 'initialPreviewConfig', 'initialPreviewThumbTag', 'newsGallery', 'fieldName')); }
</div> <div class="tab-pane" id="seo-tab"> <?php echo $form->field($model, 'redirect')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput']]); ?> <?php echo $form->field($model, 'meta_title')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput']]); ?> <?php echo $form->field($model, 'meta_keywords')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput']]); ?> <?php echo $form->field($model, 'meta_description')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextarea']]); ?> </div> </div> </div> <!-- /.nav-tabs-custom --> <div class="form-group text-center"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('b/news', 'Create') : Yii::t('b/news', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();
<div>{actions}</div> </div>', 'actionUpload' => '', ], 'overwriteInitial' => false, 'showClose' => false, 'uploadUrl' => true, 'showUpload' => false, 'showRemove' => false, 'initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'autoReplace' => true, 'maxFileCount' => 100, 'language' => Yii::$app->getModule('radiata')->activeLanguage['code'], 'previewThumbTags' => [ '{CUSTOM_TAG_NEW}' => Html::hiddenInput('GalleryFilesSources[NEW_IND]', '') . $form->field($newsGallery, '[NEW_IND]image_text')->label(Yii::t('b/radiata/common', 'Image text'))->widget(LangInputWidget::classname(), [ 'options' => [ 'id' => 'galTabsNEW_IND', 'type' => 'activeTextInput', 'additionalCssClasses' => 'kv-input kv-new form-control input-sm', ], ]), '{CUSTOM_TAG_INIT}' => '', '{TAG_CSS_NEW}' => '', '{TAG_CSS_INIT}' => 'hide', ], 'initialPreviewThumbTags' => $initialPreviewThumbTag, ], 'pluginEvents' => [ 'fileloaded' => "function(event, file, previewId, index, reader) {
use yii\bootstrap\ActiveForm; use yii\helpers\Html; /* @var $model common\modules\news\models\NewsTag */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="news-tags-form"> <?php $form = ActiveForm::begin(['id' => 'new-tag-form', 'layout' => 'horizontal', 'fieldClass' => RadiataField::className()]); ?> <?php echo FieldHelper::showErrors($model); ?> <?php echo $form->field($model, 'name')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextInput']]); ?> <div class="form-group text-center"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('b/news/tag', 'Create') : Yii::t('b/news/tag', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>