When installing a site with config_installer or running `drush cim` on a broken installation site, I get this error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:break_lock:node" plugin does not exist. in [error]
/var/www/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52
From the stack trace, this basically starts from \Drupal\content_lock\EventSubscriber\SettingsSaveEventSubscriber:49
:
if (empty($action)) {
$action = $this->entityTypeManager->getStorage('action')->create([
'id' => $type . '_break_lock_action',
'label' => 'Break lock ' . $type,
'plugin' => 'entity:break_lock:' . $type,
'type' => $type,
]);
$action->save();
The above block was introduced in
#2938600: Add new Bulk Action to Break Lock β
.
The problem is that this early in the process, the node module is not yet installed and yet we try to install a plugin with a reference to node. The BreakLockDeriver does not return a plugin (since the node is not installed) and there is the above exception.
Now, I think that this should have been implemented as a config entity so that we can define dependencies. That's a big task and may not be worth it here, and I am thinking of other things.
I have a question as well: What happens when a new entity is defined after the module is installed? Is the action added in some other manner? I can't find any references to that in the code but didn't really look thoroughly.