Is there a way to support the core option of "Create referenced entities if they don't already exist"?

It does not seem to work. The add field seems to only support existing entities. Am I missing something?

Thanks.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

duckydan created an issue. See original summary.

duckydan’s picture

Category: Support request » Bug report

I have been messing with this for a while.

From what I can see, you cannot create new entities, even if the reference field is set to do that.

The form is there to add a new entity. But it throws an ajax error in the js console.

[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (edit, line 0)
[Error] AjaxError: 
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /node/2/edit?ajax_form=1
StatusText: Internal Server Error
ResponseText: The website encountered an unexpected error. Please try again later.
	(anonymous function) (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:264:13136)
	complete (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:264:5845)
	(anonymous function) (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:309:3569)
	c (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:3:25272)
	fireWith (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:3:26017)
	l (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:3:77858)
	(anonymous function) (js_E-PluqRkPYBpQNMkwlIH8AvocHf0XJoRhj1lJ40izzM.js:3:80206)

I assumed it was a conflict with another module, so I installed a plain 10.1.6 with zero contrib modules other than this one. I created an entity reference field and could create and reference both existing, and new nodes. So it works fine using the default Drupal widget.

I added the dev version of entityqueue and set the form to use it on that field.

It fails every time.

Here is some more info:

PHP 8.1.12
Apache 2.4.55
db is 10.11.2-MariaDB
Memory is set to 256MB

I would REALLY like to get this module working. It is an ideal solution for my site.

Any input is welcome. Am I really the only one running into this?

duckydan’s picture

Version: 8.x-1.7 » 8.x-1.x-dev
duckydan’s picture

Priority: Normal » Major

I just installed a plain vanilla Drupal via composer on a site with no CDN or Varnish or anything. I created two articles. I have added a reference field to the basic page content type to allow selecting articles, with the option to create new ones.

It totally failed with the exact same error.

So, for Drupal 10.1.6, the ability for Entityqueue to allow adding nodes is totally broken.

I am not great at troubleshooting ajax stuff like this, so I don't know how to fix this.

I will set this to a high priority because an essential functionality in core breaks when using this as a widget.

duckydan’s picture

I will leave the site I made to test this up. If anyone wants to log in and mess around, I would happily provide the needed info.

duckydan’s picture

I was able to get exactly what I needed from IEF (better, actually), but I would be willing to test any fixes for this.

amateescu made their first commit to this issue’s fork.

  • amateescu committed 44fc54a4 on 8.x-1.x
    fix: #3395293 Support creating entities
    
    By: amateescu
    By: duckydan
    
amateescu’s picture

Status: Active » Fixed

Merged a fix for this :)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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