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
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
If you want to hide the buttons for all instances of Redactor you can add this into the module config
'modules' => [
'redactor' => [
'class' => 'yii\redactor\RedactorModule',
'widgetClientOptions' => [
'buttonsHide' => ['image','file'],
]
],
],
Otherwise you can add this to the individual call
<?= $form->field($model, 'reason')->widget(\yii\redactor\widgets\Redactor::className(), [
'clientOptions' => [
'buttonsHide' => ['image','file'],
]
])?>
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);
}