Roby Sottini
Roby Sottini

Reputation: 2265

Yii2: How to change ExportMenu config without modifying vendor folder?

I need to change the word "Text" to "Texto" for the kartik-v/yii2-export widget that generate a text file.

I can change it in the vendor/kartik-v/yii2-export/src/ExportMenu.php file but I think it is not recommended to change this file.

Export All button

Upvotes: 0

Views: 537

Answers (2)

Roby Sottini
Roby Sottini

Reputation: 2265

In the view file:

'exportConfig' => [
    ExportMenu::FORMAT_TEXT => [
        'label' => 'Texto'
    ],
    ExportMenu::FORMAT_EXCEL => [
        'label' => 'Excel 95 o superior'
    ],
    ExportMenu::FORMAT_EXCEL_X => [
        'label' => 'Excel 2007 o superior'
    ],
],

Upvotes: 0

WardNsour
WardNsour

Reputation: 354

Add exportConfig , Change the label

]
    ExportMenu::FORMAT_TEXT => [
        'label' => Yii::t('kvexport', 'Text'),
        'icon' => $isFa ? 'file-text-o' : 'floppy-save',
        'iconOptions' => ['class' => 'text-muted'],
        'linkOptions' => [],
        'options' => ['title' => Yii::t('kvexport', 'Tab Delimited Text')],
        'alertMsg' => Yii::t('kvexport', 'The TEXT export file will be generated for download.'),
        'mime' => 'text/plain',
        'extension' => 'csv',
        'writer' => ExportMenu::FORMAT_TEXT
    ],
.
.
]


Please check this link for further information [Krajee export](https://demos.krajee.com/export)

Upvotes: 1

Related Questions