- Issue created by @TolstoyDotCom
- 🇸🇪Sweden peter törnstrand
Using the instructions from the test module. If you add
field.field.node.article.field_stillthere
as a config dependency in the role you at least get a warning when you delete the file. - 🇸🇪Sweden peter törnstrand
I did some digging and the way this is handled for node bundles in core is that a dependencies key is added to the permissions array declaring the dependency on the node bundle like this:
dependencies: config: - node.type.article
The dependencies key is added via trait
Drupal\Core\Entity\BundlePermissionHandlerTrait
which in turn calls these methods:Drupal\Core\Entity\EntityInterface::getConfigDependencyKey() // returns 'config' for a node bundle Drupal\Core\Entity\EntityInterface::getConfigDependencyName() // returns 'node.type.<BUNDLE>' for a node bundle
So I guess the correct way to solve this issue is to add the dependencies key to the permissions array.
I'm attaching a patch for the Test delete field module just to make it clear what I mean.