Problem/Motivation
When installing a site from existing configuration (e.g., via configuration sync or a distribution), roles with form_mode_control permissions (e.g., "Use the form mode X linked to node entity Y") trigger errors like:
Non-existent permission(s) assigned to role "editor" (editor) were removed. Invalid permission(s): use The form mode my_form_mode linked to node entity( article ).
This happens because those dynamically-generated permissions are missing proper dependencies on their associated core.entity_form_display configs. As a result, if the form display config isn't present, due to config import order for example, Drupal can't cleanly manage the permission.
Steps to reproduce
- Install form_mode_control module and create custom form modes.
- Assign the generated form mode permissions to a role.
- Export config.
- Import config in a clean install.
- Observe warnings about invalid permissions removed from roles.
Proposed resolution
- Add a 'dependencies' => ['config' => ['core.entity_form_display.X.Y.Z']] entry for each form mode permission in
roleToFormMode(). - Provide a hook_update_N() implementation to trigger recalculating role config dependencies for existing sites.
| Comment | File | Size | Author |
|---|
Issue fork form_mode_control-3524072
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 #3
redwan jamous commentedAttaching static patch file to use with composer...
Comment #4
redwan jamous commentedComment #6
dieterholvoet commentedComment #8
dieterholvoet commentedThanks for your contribution!