Closed misyuari closed 6 years ago
public function isBs4() { if (!isset($this->_isBs4)) { $this->initBsVersion(); } var_dump($this);die; return $this->_isBs4; } get return object(kartik\file\SortableAsset)#423 (12) { ["bsVersion"]=> NULL ["bsPluginEnabled"]=> bool(false) ["depends"]=> array(1) { [0]=> string(16) "yii\web\YiiAsset" } ["_isBs4":"kartik\base\AssetBundle":private]=> bool(false) ["js"]=> array(1) { [0]=> string(22) "js/plugins/sortable.js" } ["css"]=> string(9) "K3/@$$3T$" ["sourcePath"]=> string(36) "@vendor/kartik-v/bootstrap-fileinput" ["basePath"]=> NULL ["baseUrl"]=> NULL ["jsOptions"]=> array(0) { } ["cssOptions"]=> array(0) { } ["publishOptions"]=> array(0) { } }
here my view
<?php echo $form->field($model, 'photo_path')->widget(\kartik\file\FileInput::className(), [ 'options' => ['accept' => 'image/*'], 'bsVersion' => '4.x', 'pluginOptions' => [ 'showCaption' => true, 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->photo_path ? HTML::img(Yii::$app->getUrlManager()->getBaseUrl().'/'.$model->photo_path, ['width' => 100]) : '', 'overwriteInitial' => true, ] ] );?>
Check the Fileinput widget docs on how to configure widget for Bootstrap 4 (and the required pre-requisites).
public function isBs4() { if (!isset($this->_isBs4)) { $this->initBsVersion(); } var_dump($this);die; return $this->_isBs4; } get return object(kartik\file\SortableAsset)#423 (12) { ["bsVersion"]=> NULL ["bsPluginEnabled"]=> bool(false) ["depends"]=> array(1) { [0]=> string(16) "yii\web\YiiAsset" } ["_isBs4":"kartik\base\AssetBundle":private]=> bool(false) ["js"]=> array(1) { [0]=> string(22) "js/plugins/sortable.js" } ["css"]=> string(9) "K3/@$$3T$" ["sourcePath"]=> string(36) "@vendor/kartik-v/bootstrap-fileinput" ["basePath"]=> NULL ["baseUrl"]=> NULL ["jsOptions"]=> array(0) { } ["cssOptions"]=> array(0) { } ["publishOptions"]=> array(0) { } }
here my view