I have two modules that both extend NodeForm the usual way:
function MY_MODULE_entity_type_alter(array &$entity_info) {
$entity_info['node']->setFormClass('default', 'Drupal\MY_MODULE\Form\MyModuleNodeForm');
$entity_info['node']->setFormClass('edit', 'Drupal\MY_MODULE\Form\MyModuleNodeForm');
}
As far as I can tell (both from actually looking into what setFormClass()
does and simply trying out) this is a race condition that only one of them can win. Although they both want to deal with different content types and what they do would not conflict at all, they can't coexist. With the old, 7-style alter and submit functions, this could be solved but what would be the proper 8-ish way to do it? Both modules are mine, I can combine them if necessary but that wouldn't be really elegant.