With latest dev of entityreference, we are getting this warning on all pages of the site.

Notice: Undefined index: target_bundles in context_admin_entityref_create_node_get_children() (line 34 of profiles/concern/modules/contrib/context_admin/plugins/context_admin/entityref_create_node.inc).

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new887 bytes

This happens when you have entityreference fields defined that don't use target bundles. Attached patch resolves. On a side note though, I fail to see why context_admin_entityref_create_node_get_children is being called on all pages of the site. Surely thats overkill.

JSCSJSCS’s picture

StatusFileSize
new34.08 KB
new16.57 KB

I just started learning this terrific module. I have been changing a lot of settings and came across a similar error (notice) and found this issue queue item. My notice was:

Notice: Undefined index: entityref_create_node:dealer_record_corrections:field_dealer_record_ref in context_admin_entityref_create_node_get_child() (line 22 ofC:\wamp\www\local.nfsgunex.com\sites\all\modules\contrib\context_admin\plugins\context_admin\entityref_create_node.inc).

In one of my content types (while playing with Rules), I unselected the entity target bundle selections of an Entity Reference field. I had already created a context admin page that used the field. By unselecting the choice in the entity reference target bundles settings, I got the notice, but only when the context admin page was called, not on every page.

I also found that I got the same notice when I went to the context admin settings in page manager. I found that I no longer had the content choice to create the node from node reference that I had when the entity reference field target was specifically set.

Not sure if this is a feature request or bug?

Content type entity reference settings

Context Admin settings

JSCSJSCS’s picture

I just wanted to add that after I re-selected the entity bundle, the context admin option to create the node with autoref became visible and was select-able, but another content type was being created, not the selected one. I tried selecting an different content option (like admin section), Update and save, and re-select the node add, but to no avail. Nothing changed. Clearing cache, nada.

I was stuck in some kind of no mans land that would not create the content I wanted. Ultimately, I had to delete the page manager page and start over and then everything worked again.

andypost’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new886 bytes

Suppose empty() here makes more sense

Sinovchi’s picture

patch in #4 is perfectly working

mrfelton’s picture

Patch in #4 looks good from here too.

eclipsegc’s picture

Status: Reviewed & tested by the community » Fixed

pushed, next dev should have this.

Status: Fixed » Closed (fixed)

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