- Issue created by @murz
- 🇦🇲Armenia murz Yerevan, Armenia
In the form code, I've found that without this checkbox the config simply deletes:
public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->configFactory->getEditable($this->getConfigId()); if (empty($form_state->getValue('enabled'))) { $config->delete(); } else { $fields = []; foreach ($form_state->getValue('fields') as $field_name => $data) { if (!empty($data['processor'])) { $fields[$field_name]['id'] = $data['processor']; } } $config->set('enabled', TRUE); $config->set('local_task_label', $form_state->getValue('local_task_label')); $config->set('fields', $fields); $config->save(); } }
I think it's a pretty strange behavior because sometimes we need just to disable and then enable back, without re-filling a lot of field settings.
So, maybe add a separate action "Delete" instead of this trick?
Additionally, maybe make the "local_task_label" field required? Because now it can be empty that produces an invisible tab item.
- First commit to issue fork.
- Merge request !7Issue #3365088 by Murz, orakili: Separate deleting and disabling configuration. → (Open) created by orakili
- Assigned to orakili
- Status changed to Needs review
8 months ago 4:45am 3 April 2024 - 🇯🇵Japan orakili
MR to separate deleting a configuration from enabling/disabling it: https://git.drupalcode.org/project/content_entity_clone/-/merge_requests/7