Everyone involved in the References module that I've seen likes the idea of deprecating that module in favor of Entity Reference, which is more generalized. Of course, that is not NodeReference, and therefore the support in CA for adding a node-add form that pre-populates a nodereference field has no effect.

Being the forward-thinker that I am, I'm building a site entirely with Entity Reference. Which of course means I'm finding all kinds of modules that need to now support Entity Reference, like this one. :-)

I'm not sure how ER support would look, since you may need to select or detect the referenced entity type, but I'm assuming it wouldn't be TOO difficult to add support for?


EclipseGc’s picture

Entity Reference has a couple short comings in this arena, specifically the fact that its schema is not kept up to date from a "foreign key" stand point. If it were, then there's definitely a potential for this sort of thing to be automatically understood by the plugin system and build require contexts accordingly, however...

Context_admin 1.x has a specific short coming in that you must build custom plugins for things I don't provide... that seems sort of intuitive at first glance, but long term I want a 2.x branch that is largely entity agnostic (except in the case of weird entities like users) that allows your entity/bundle's fields and properties to be exposed in the setup UI and then allows tokens from available contexts to fulfill the various fields. In this way as long as these things were exposed in some way that CA can decipher then it should be possible to set a whole bunch of fields values simultaneously regardless of their field type, or what sort of data they WANT to consume (which could also result in all sorts of data issues, but that's sort of a separate problem).

As a compromise, if you'll dig into entity reference and get a patch together that will schema_alter in the appropriate foreign keys for it, I will gladly update context admin to support children plugins and help build a plugin and module specific for entity_reference field auto population. It shouldn't actually be THAT difficult.

Crell’s picture

After discussing this with EclipseGc in IRC, we concluded that hook_schema_alter is probably not necessary since CA doesn't read the DB schema but the schema from hook_field_schema(). That means we should be able to handle this with just a small patch to entity_reference. We'll see if that works.

Crell’s picture

Actually it looks like Amitai is already working on it: #1340748: Add CTools relationship

EclipseGc’s picture

Status: Active » Fixed

Added an entityref_create_node plugin to dev.

superjerms’s picture

Is there a way to install just that plugin, so that I don't put a dev build onto a production site (or is that a bad idea)?

EclipseGc’s picture


My devs are generally as stable as my releases are (which is saying something good about dev, I don't like pushing code that I've not tested a bit) if you have an issue with the dev I'll drop what I'm doing to try to fix it (generally) so... There are VERY few differences between this dev and the release, mostly just this plugin.


micnap’s picture

What would be involved in creating a entityref_create_user plugin? I have users and I have a certification entity type. I need to be able to add a certification that automatically gets attached to that user.


Status: Fixed » Closed (fixed)

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