The entityreference_field_widget_form function fails when the target entity of a field no longer exists. It ends with the exception

Missing bundle property on entity of type node. in entity_extract_ids() (line 7721 of /data/development/drupal/wwffundraising/includes/common.inc

which is caused by calling the EntityReference_SelectionHandler_Generic->getLabel function with a NULL value as the $entity argument.

I ran into this when a customer deleted some nodes that he thought were no longer in use. Unfortunately they were still in use and with this error it is/was impossible to fix the entity containing the reference since the edit form failed to render.

I have attached a very simple and specific fix for this issue. It could certainly be improved upon but at this point I think the safest thing to do is to just let the user know that the referenced entity is missing.

CommentFileSizeAuthor
missing-target-entity.patch722 bytesgetu-lar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MustangGB’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Is this still an issue in the latest version?

MustangGB’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)