diff --git a/config/install/bulk_update_fields.settings.yml b/config/install/bulk_update_fields.settings.yml index 4426f0e..451dec6 100644 --- a/config/install/bulk_update_fields.settings.yml +++ b/config/install/bulk_update_fields.settings.yml @@ -1 +1 @@ -bulk_update_fields: +exclude: { } diff --git a/config/schema/bulk_update_fields.schema.yml b/config/schema/bulk_update_fields.schema.yml new file mode 100644 index 0000000..a15fd43 --- /dev/null +++ b/config/schema/bulk_update_fields.schema.yml @@ -0,0 +1,10 @@ +bulk_update_fields.settings: + type: config_object + label: 'Bulk Update Fields settings' + mapping: + exclude: + type: sequence + label: 'Bulk update exclude field' + sequence: + type: string + label: "Field Name" diff --git a/config/schema/system.action.bulk_update_fields_action_base.schema.yml b/config/schema/system.action.bulk_update_fields_action_base.schema.yml new file mode 100644 index 0000000..f0dc81d --- /dev/null +++ b/config/schema/system.action.bulk_update_fields_action_base.schema.yml @@ -0,0 +1,19 @@ +system.action.bulk_update_fields_action_base: + type: config_entity + label: 'Bulk Update Fields to Another Value' + mapping: + id: + type: string + label: 'ID' + label: + type: string + label: 'Label' + type: + type: string + label: 'Type' + plugin: + type: string + label: 'Plugin' + configuration: + type: action_configuration_default + label: 'Action configuration' diff --git a/src/Form/BulkUpdateExcludeForm.php b/src/Form/BulkUpdateExcludeForm.php index 2ee95b2..0eb3b51 100644 --- a/src/Form/BulkUpdateExcludeForm.php +++ b/src/Form/BulkUpdateExcludeForm.php @@ -161,8 +161,15 @@ class BulkUpdateExcludeForm extends ConfigFormBase { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { + $checked_values = []; + foreach ($form_state->getValue('table') as $key => $value) { + if ($value) { + $checked_values[$key] = $value; + } + } + $this->config('bulk_update_fields.settings') - ->set('exclude', $form_state->getValue('table')) + ->set('exclude', $checked_values) ->save(); }