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.

Comments

SpadXIII created an issue. See original summary.

spadxiii’s picture

StatusFileSize
new564 bytes
agentrickard’s picture

Status: Active » Needs work

Are there any other places where we need this sort of check? Doesn't look like it since domain_source_form_node_form_alter() calls to DomainElementManager::setFormOptions() which runs an isset() check.,

Ideally, we'd have a test for this.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new2.1 KB

Here's a version of the patch with a working test.

If no response by Friday, I'm going to commit it.

  • agentrickard authored 12551b2 on 8.x-1.x
    Merge pull request #351 from agentrickard/ds-error
    
    Issue #2892612 by...
  • agentrickard committed c7c8036 on 8.x-1.x authored by SpadXIII
    Issue #2892612 by SpadXIII: Domain source trips over deleted...
agentrickard’s picture

Status: Needs review » Fixed

Nice work!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.