In my site I have a few content types that should not have a domain source, so I have deleted the field. But now when creating a node of that type, domain_source throws an error, because it cannot find the field anymore.
Attached a small patch with a simple isset-check.
For this site, I hide the field for the editors by not showing it in the form-display mode of the content types that should have a domain source. In hook_entity_field_values_init I set it to the current active domain id if the field is available for the entity.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2892612-domain-source-field.patch | 2.1 KB | agentrickard |
| #2 | 2892612-2.patch | 564 bytes | spadxiii |
Comments
Comment #2
spadxiii commentedComment #3
agentrickardAre there any other places where we need this sort of check? Doesn't look like it since
domain_source_form_node_form_alter()calls toDomainElementManager::setFormOptions()which runs an isset() check.,Ideally, we'd have a test for this.
Comment #4
agentrickardHere's a version of the patch with a working test.
If no response by Friday, I'm going to commit it.
Comment #6
agentrickardNice work!