- Issue created by @Odai Atieh
- πΊπΈUnited States partdigital
Hi Odai, thanks for reporting this!
I was able to reproduce the issue. It indeed depends on the order in which the modules are enabled. If you enable the access_policy module first, the menu_content_item entity won't be updated to support the access_policy field. (menu_content_item__access_policy).
What is odd is that for other modules it works as expected. For example, I can install the paragraphs module in any order and the access policy field gets added with no problem. This is probably happening because menu_item_extras is modifying an existing entity rather than creating a new one.
My guess is that this is caused by a few factors coming together.
- By default, Drupal core content menu items do not support Access Policy.
- If access policy is enabled before menu_item_extras it sees that Access policy is not supported and doesn't add the field. If you then enable menu_item_extras it won't try to re-add the field. (which makes sense)
- When menu_item_extras is enabled before it adds bundles which opens Access policy support.
- If access policy is enabled after menu_item_extras it sees that Access is supported and it adds the field.
You found a good one!
A quick fix I can add is to simply exclude content menu items from Access policy entirely, unless of course you need to support Content menu items. Then I'll need to find another approach.
- Merge request !6Issue #3405229 by partdigital, Odai Atieh: Order of module installation prevents proper access_policy field creation. β (Merged) created by partdigital
- Status changed to Needs review
12 months ago 1:05pm 2 December 2023 - πΊπΈUnited States partdigital
I've opened an MR for this issue. https://git.drupalcode.org/project/access_policy/-/merge_requests/6
I've added an `installAccessPolicyField` method to the access policy create form that will only execute if the field does not exist. This is essentially a backup feature for rare cases (such as this) where the access policy field isn't properly installed.
Give it a try and let me know if you encounter any other issues. Thanks again for finding this!
- πΊπΈUnited States partdigital
I've updated the MR so that it will attempt to install the field on access policy insert (if it doesn't exist). This addresses an issue with the previous approach where it may not be properly installed during configuration import.
- Status changed to RTBC
12 months ago 2:09pm 7 December 2023 -
partdigital β
committed 5497e41e on 1.0.x
Issue #3405229 by partdigital, Odai Atieh: Order of module installation...
-
partdigital β
committed 5497e41e on 1.0.x
- Status changed to Fixed
12 months ago 2:30pm 7 December 2023 Automatically closed - issue fixed for 2 weeks with no activity.