Problem/Motivation
When I access to admin/people section, the module configuration is reset to default values
Steps to reproduce
- Create an extra entity form (step 1.png);
- Assign created form as default (step 2. png);
- Access to admin/people (step 3.png);
Details
The Configuration form /admin/structure/display-modes/form/config-form-modes
serializes the selected modes in the configuration with key form_mode_control.settings
The exact configuration keeps the permissions and the selected form modes for each role.
drush config-get form_mode_control.settings
The roleToFormMode()
method in web/modules/contrib/form_mode_control/src/FormModePermission.php
file is called every time the user visits the Permissions table /admin/people/permissions
.
The purpose of this method is to rebuild and serialize the permission. The highlighted lines below also try to clean up things and purge anything that is not reset. However, what remains is also the configuration of the display modes, something that is also removed.
This is what causes the misbehavior this ticket is about.
Solution(s)
A. Split the configuration keys
Use two places for storing configuration values
Permissions:form_mode_control.permissions
Here we store the values from the permissions table. The purge method needs no changes since it will have no side-effect when removing all the leftovers, as it currently does.
Form settings:
form_mode_control.settings
Here is where we store the link between the form modes and the user roles /admin/structure/display-modes/form/config-form-modes
B. Identify the entries before purge
This is what patch in
Comment #9
🐛
Access to admin/people view, reset configuration to default
Closed: cannot reproduce
does.
It ignores the entries/line containing in their key the words creation
and modification