I want more button in yii2-fileinput-widget.
My current code is like this:
$allPics = \common\models\Picture::getPictures($album->id);
$images = [];
$imagesOptions = [];
if($allPics){
foreach ($allPics as $pic){
$key = $pic->id;
$url = Url::to(['set-pic-status', 'id'=>$key, 'pid'=>$model->id, 'do'=>'remove']);
$images[] = Yii::$app->urlManagerFront->createAbsoluteUrl(['image/index', 'id'=>$pic->id, 'width'=>300, 'height'=>300]);
$imagesOptions[] = ['caption' => $pic->name, 'size' => $pic->size , 'url'=>$url, 'key'=>$key];
}
}
echo FileInput::widget([
'name' => 'pic',
'language'=>'fa',
'options'=>[
'multiple'=>true
],
'pluginOptions' => [
'uploadUrl' => Url::to(['pic-upload', 'id'=>$model->id]),
'initialPreview'=>$images,
'initialPreviewAsData'=>true,
'initialCaption'=>"تصاویر محصول",
'initialPreviewConfig' => $imagesOptions,
'overwriteInitial'=>false,
'maxFileSize'=>2800,
]
]);
Now I need add one more button near remove button to send some data to server and set selected picture as cover or change status of picture in db.
How can I do that?
try this:
'otherActionButtons' => '...';