- 🇬🇧United Kingdom altcom_neil
Hi,
I don't think what your initial patch does what the update hook was meant to be doing.
I think it was intended to convert the 7.x version of the modules config to the 8.x version. It should be something like:
function readonlymode_update_8001() { $settings = \Drupal::configFactory()->getEditable("readonlymode.settings"); if (isset($settings['site_readonly'])) { // Config from the 7.x branch needs updating to 8.x structure. $new_settings = [ 'enabled' => $settings['site_readonly'], 'url' => $settings['site_readonly_url'], 'messages.default' => $settings['site_readonly_message'], 'forms.additional.edit' => $settings['site_readonly_forms_allowed'], 'forms.additional.view' => $settings['site_readonly_forms_viewonly'], ]; $settings->setData($new_settings); $settings->save(); return 'Updated readonlymode.settings configuration to 8.x version.'; } return NULL; }
I haven't tested this as we didn't use the 7.x version.
- Status changed to Needs work
4 months ago 3:13pm 19 July 2024 I think you're right. The changes are completely wrong. Can you update the MR?