We are using this module on a website that also uses config_readonly.
When I try to access any admin page, it crashes with this error:
[Tue Apr 16 16:47:26.203534 2019] [php7:notice] [pid 23496] [client 127.0.0.1:54246] Uncaught PHP Exception Drupal\\config_readonly\\Exception\\ConfigReadonlyStorageException: "Your site configuration active store is currently locked." at /home/insite/production/sites/insite-scalab/web/modules/contrib/config_readonly/src/Config/ConfigReadonlyStorage.php line 141
This seems to happen because roleToFormMode() is called on each admin page load and tries to save permissions in the config everytime. (And our config is currently locked by config_read_only.)
The attached patch correctly works around the issue for us, by preventing $configuration->set() if this configuration key already exists.
(But maybe a cleaner way to solve this would be to save the configuration only when new form modes are created.)
| Comment | File | Size | Author |
|---|
Issue fork form_mode_control-3048591
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
prudloff commentedComment #3
jonraedeke commentedThe patch in #2 works for me. /admin/people was also white screening for me before applying this patch.
I'm a little confused why this module needs to set permissions on those pages. It's a huge performance hit as well.
Comment #4
mandclu commentedComment #5
mandclu commentedThere was a more substantial refactoring of the permissions code in #3046679: Drupal Extend (module page) hangs after installing Form Mode Control so hopefully that will address the concern raised here. If not, feel free to reopen it.
I'm inclined to agree that in general the permission code should be run much more selectively, but I'll have to give some some more thought on what the new approach will be, and likely include that in a new major release.
Comment #6
timwoodWe are still encountering this issue after updating to the 2.0 release of form_mode_control as part of our upgrade from Drupal 8.9 to 9.2. The error occurs when config_readonly is enabled and enforced and only for certain admin screens such as /admin/people, /admin/people/permissions, /admin/people/permissions/[ROLE]. If we uninstall the form_mode_control module, the error goes away. If config_readonly enforcement is set to FALSE, the error goes away. If I downgrade to the 8.x-2.0-rc6 release and apply the patch from this issue, the error goes away.
Comment #7
foodslover commentedThis patch will fix the config_readonly bug for 8.x-2.0
Comment #8
timwoodSetting as needs review and hiding older patch file.
Comment #9
mandclu commentedApologies, it seems that once again I've merged another issue that makes substantial changes to the FormModePermission class, this time #3228381: Container rebuild performance. Can someone test if a fix here is still needed, and if so provide an updated patch?
Comment #10
foodslover commentedThis patch fixes the config_readonly (8.x-1.0-beta4) bug for form_mode_control v8.x-2.1
Comment #13
dieterholvoet commentedComment #15
dieterholvoet commented