3

i still building a drupal site with civicrm and civicrm_entity support and get stucked by adding form fields for adding synced contacts.

a single contact is possible, but i need an email, phone and address field in addition. for that i used the civicrm entity reference field in the contact entity to add these references.

but it seems that civicrm_entity cant support the submission of the fields to the civicrm database, because in the time where i send the form, the civicrm id doesnt exist. for that other ref fields cant have the needed civicrmID.

did i miss something, or is this the wrong way to realise a contact submission with reference entitys from a drupal node to civi?

enter image description here

2
  • 1
    This is a current limitation of the CiviCRM Entity Reference module. It doesn't work with adding an entity, although there is a PR to start allowing this that is in my queue to review and should be pushed to the D.O page very soon. Currently to work around this, the method goes like this, do a hook_form_alter implementation, set the contact_id to some dummy value, then add a submit handler, in that submit handler update the contact_id of the child entities with the id of the contact after it is saved and has an id....Although this will be in the official release of CiviCRM Entity coming soon Mar 22, 2017 at 14:14
  • Here's the PR, if you want to test it out, and provide feedback, that would be great...github.com/eileenmcnaughton/civicrm_entity/pull/102 Mar 22, 2017 at 14:26

1 Answer 1

1

So I've done some development to enable CiviCRM Entity Reference (CER) fields that target CiviCRM Contacts, either via the Drupal contact edit form "/civicrm-contact/add" or via an entityreference field targeting contacts (which form has CER fields attached), that can be on nodes or other entity types, using the Inline Entity Form Single widget.

Its available now on the -dev version of CiviCRM Entity, and will be in the next beta.

Support for the Inline Entity Form Multi widget is not yet included, it will take another small leap to get it working there, although the foundation is now laid.

The functionality for inline entity forms on either reference field type has worked and continues to work for node/entity edits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.