Closed therealkevinard closed 4 years ago
Hello @therealkevinard, thank you for your contribution.
I think the correct way how to extend plugin is described here: https://octobercms.com/docs/plugin/extending
Try to use something like that:
Event::listen('backend.form.extendFields', function ($widget) {
if (!$widget->getController() instanceof UserImportExport) {
return;
}
if (!$widget->model instanceof UserExportModel) {
return;
}
$controler = $widget->getController();
});
Also check my overriding example repository, where you can find handy addColumns
and addFields
method: https://github.com/vojtasvoboda/oc-brands-plugin-override-example
Good luck, Vojta.
Okay, fair enough :) I didn't realize the traditional extend would work for this as well.
I take back my PR.
Provide a backend config option to allow end-users to inject custom $importExportConfig.
RainLab/User might be the most extended plugin on the market. This config allows a (fairly advanced) feature for overriding the default import/export config.
Example Usage:
$/my/plugin/vojtasvoboda_userimportexport/
config_import_export.yaml
export: title: Export Users modelClass: VojtaSvoboda\UserImportExport\Models\UserExportModel list: $/my/plugin/vojtasvoboda_userimportexport/userexport_columns.yaml # uses customized config for export redirect: rainlab/user/users
===================================
Column Definitions
===================================
columns:
id: label: Id invisible: true
username: label: rainlab.user::lang.user.username searchable: true invisible: true
name: label: rainlab.user::lang.user.name searchable: true
surname: label: rainlab.user::lang.user.surname searchable: true invisible: true
email: label: rainlab.user::lang.user.email searchable: true
// Custom fields added elsewhere address_1: label: Address address_2: label: Address 2 city: label: City state_region: label: State postcode: label: Zip Code country: label: Country membership_payment_source: label: Source member_status: label: Status