I am using Yii2 Redactor from Here. I want to remove Image and File Upload.
view Code :
<?= $form->field($model, 'reason')->widget(
\yii\redactor\widgets\Redactor::className(), [])
?>
Screenshot
On
In this library, you just have to update file i.e. Redactor.php at path yii2-redactor/widgets/Redactor.php
Now update method defaultOptions. Comment or Remove line from 92 to 103 Here is code of these lines:
$this->setOptionsKey('imageUpload', $this->module->imageUploadRoute);
$this->setOptionsKey('fileUpload', $this->module->fileUploadRoute);
$this->clientOptions['imageUploadErrorCallback'] = ArrayHelper::getValue($this->clientOptions, 'imageUploadErrorCallback', new JsExpression("function(json){alert(json.error);}"));
$this->clientOptions['fileUploadErrorCallback'] = ArrayHelper::getValue($this->clientOptions, 'fileUploadErrorCallback', new JsExpression("function(json){alert(json.error);}"));
if (isset($this->clientOptions['plugins']) && array_search('imagemanager', $this->clientOptions['plugins']) !== false) {
$this->setOptionsKey('imageManagerJson', $this->module->imageManagerJsonRoute);
}
if (isset($this->clientOptions['plugins']) && array_search('filemanager', $this->clientOptions['plugins']) !== false) {
$this->setOptionsKey('fileManagerJson', $this->module->fileManagerJsonRoute);
}
If you want to hide the buttons for all instances of Redactor you can add this into the module config
Otherwise you can add this to the individual call