RedHen provides entities for contacts and organizations - for those entities there is no support for any "ad-hoc entity creation" modules (References dialog, entityconnect or inline entity form).

It seems easy to integrate those entities for inline entity form - so I guess it would be nice to have.

What do you think?

Thanks,
Walter

Comments

valderama’s picture

Here is a basic working version...

I am happy on suggestions or other input!

bojanz’s picture

Project: Inline Entity Form » RedHen CRM
Component: Code » redhen_contact

Sounds good, but that code should live in one of RedHen's modules, not IEF.

seanberto’s picture

I'd like to test this patch. Could you give me a use case for this feature?

valderama’s picture

Basically the use case is to have a (presentatinal) node for a contact, with an embedded redhen contact. Proving an easy way to edit the redhen contact from the within node improves the editor experience (IEF provides that)

Does that help?

seanberto’s picture

That makes sense, Walter. We'll test the patch and follow up soon.

seanberto’s picture

Status: Active » Needs review
seanberto’s picture

So, I just tested adding this controller to RedHen Contact. Attached is a simple patch that basically includes the new controller library file, calls it in the .info file and then declares the controller for the the RedHen Contact entity type.

After running the patch, I can add an inline entity reference field to a simple content type. It includes the first and last name properties for a RedHen contact on the node add/edit form. However, none of the attached fields on my RedHen Contact bundle are being included in the inline entity form. Also, it doesn't look like the entity bundle is being passed into the controller. So, while the RedHen Contact is being saved, we get the following PHP error:

Notice: Trying to get property of non-object in redhen_contact_page() (line 78 of [snip]/redhen/redhen/modules/redhen_contact/includes/redhen_contact.pages.inc).

In short, this patch needs work. We're headed in the right direction, but it's not there yet.

Please feel free to play around and reroll a patch when ready. This isn't tops on ThinkShout's priority list for RedHen, so we'd appreciate those interested in this functionality playing with it a bit and getting us a patch to test against the development branch.

Thanks!

seanberto’s picture

Title: Add support for RedHen entities » Add support in RedHen Contact module for Inline Entity Forms
seanberto’s picture

Status: Needs review » Needs work
micnap’s picture

Status: Needs work » Needs review
StatusFileSize
new4.52 KB

Setting the $contact->type = 'contact' was what was preventing the form from showing. I also added the middle name field. Seems to work great!

seanberto’s picture

Nice! I'll review when I can. I've already got a need for this on a project I'm working on....

Could you confirm, are we correctly saving the other properties on the RedHen Contact record? Like the Author ID?

micnap’s picture

Oh yeah. Good question.

checking...

Yup. Author id, revision id, type, and created and updated dates all saved correctly.

dunklea’s picture

Applied patch from #10 worked for me. Thanks, guys!

levelos’s picture

Status: Needs review » Fixed

Thanks Mickey, and sorry for taking so long to get to this. Committed in 1.x branch.

seanberto’s picture

w00t! Great to work on a patch with you two. I do such little dev work these days. ;)

Status: Fixed » Closed (fixed)

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

philipz’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Hi guys thanks for working on this. It's not working for me unfortunately.

The form is not showing up at all as when the controller is not defined. I've added support for inline entity form controller to Entityforms myself and it works fine (adding patch today I hope) so I'm a little experienced in this but can't find any problems in code for RedHen Contact.

One strange thing is that enabling IEF just for entityform works but when I enable for RedHen Contact too (on the same entity) I'm getting EntityMalformedException with entity_extract_ids error.
Not sure if this is related at all though.

ahillio’s picture

I'm using 1.x-dev from Nov 27 and the inline entity widget is enabling me to create contacts, just like magic. Can't create organizations though, but I guess that would be a separate feature request....

philipz’s picture

Which kind of entity is your IEF widget attached to?
I'm trying to use it on Entityform and I guess this is the source of my problem.

ahillio’s picture

IEF successfully working on Redhen's "organization" entity and on Casetracker's "project" entity. I created this site over the weekend, brand new.

But NOT working on an older site that was previously using Redhen 1.6 but migrated to a codebase that's using Redhen 1.x-dev from Nov27. The sites are in Aegir so I migrated the site from an old platform to a current platform and the migration process runs drush updatedb and so forth. Not working means that the field does not display on edit form when using the IEF widget, but switching widget to autocomplete and the field does show. This site uses the same code as the site on which IEF does work. Hmmm...

BTW, if it makes any difference - I'm not using the above patch, but the newer version of the module that the patch was committed to.

RecoveryHub’s picture

Hi micnap, thanks for your work on this. I noticed the original request mentioned being able to edit both Contacts and Organizations inline. I have a content type where I need to both create a contact and organization inline while creating the node. Contacts inline seems to be working fine but Organizations isn't. Can you help?

Best
Tyler

RecoveryHub’s picture

Any ideas on this? Thanks!

levelos’s picture

Status: Active » Closed (fixed)

Origin issue is still closed, pls don't reopen. If anyone is having subsequent issues, report separately.

  • Commit 9f3d1ee on 7.x-1.x, redhen-donation authored by micnap, committed by levelos:
    Issue #1854940 by micnap, seanberto, valderama: Add support in RedHen...

  • Commit 9f3d1ee on 7.x-1.x, redhen-donation, relation-roles authored by micnap, committed by levelos:
    Issue #1854940 by micnap, seanberto, valderama: Add support in RedHen...