public static function dropdown() { return function () { $input = TreeViewInput::className(); $tree = Tree::className(); return <<<CODE \$form->field(\$model, 'request_param')->widget( {$input}::className(), [ // single query fetch to render the tree 'query' => {$tree}::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Pages'], 'model' => \$model, // input model 'attribute' => 'request_param', // input attribute 'value' => \$model->route, 'asDropdown' => true, // will render the tree input widget as a dropdown. 'multiple' => false, // set to false if you do not need multiple selection 'fontAwesome' => true, // render font awesome icons 'rootOptions' => [ 'label' => '<i class="fa fa-tree"></i>', 'class' => 'text-success', ], 'options' => [ #'data-route' => (\$treeNode !== null) ? \$treeNode->route : null, ], ] ); CODE; }; }
// 'minHeight' => 200, // // 'pastePlainText' => true, // // 'pasteImages' => true, // 'plugins' => [ // 'clips', // 'fullscreen' // ], //// 'imageGetJson' => Url::to(['/blog/posts/get']), //// 'imageUpload' => Url::to(['/blog/posts/image-upload']), //// 'fileUpload' => Url::to(['/blog/posts/file-upload']), //// 'clipboardUploadUrl' => Url::to(['/blog/posts/clipupl']) // ] // ]); ?> <?php echo $form->field($model, 'category')->widget(TreeViewInput::className(), ['model' => $model, 'attribute' => 'category', 'query' => Category::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Categories'], 'asDropdown' => true, 'multiple' => false, 'showInactive' => true, 'fontAwesome' => true, 'rootOptions' => ['label' => '<i class="fa fa-tree"></i>', 'class' => 'text-success']]); ?> <?php echo $form->field($model, 'tags')->widget(SelectizeTextInput::className(), ['loadUrl' => ['/blog/posts/tagslist'], 'options' => ['class' => 'form-control'], 'clientOptions' => ['plugins' => ['remove_button'], 'valueField' => 'tags', 'labelField' => 'tags', 'searchField' => ['tags'], 'create' => true]]); ?> <div class="row-fluid"> <?php echo $form->field($model, 'attachments')->widget(UplWidget::className(), ['uploadUrl' => Url::toRoute(['/blog/posts/uploadfile']), 'previewUrl' => $model->module->ImagePathPreview, 'tempPreviewUrl' => $model->module->ImageTempPathPreview, 'KeyFolder' => $model->id]); ?> </div> <div class="row-fluid"> <?php echo $form->field($model, 'gallery')->widget(UplWidget::className(), ['uploadUrl' => Url::toRoute(['/blog/posts/uploadfile']), 'previewUrl' => $model->module->ImagePathPreview, 'tempPreviewUrl' => $model->module->ImageTempPathPreview, 'KeyFolder' => $model->id, 'galleryType' => true]); ?> </div>