2

I have enabled the CiviCRM Entity module. How can we create an event location and event in CiviCRM using a single form submission?

This functionality was achievable in Drupal 7 using https://skvare.com/blog/civicrm-entity-and-drupal-integration-whats-new-whats-next.

Is there a way to achieve the same in Drupal 8/9/10?

1
  • Interested in this as well.
    – Dave T
    Commented Aug 27 at 15:15

1 Answer 1

5

seems doable using https://www.drupal.org/project/inline_entity_form.

Steps I followed was:

  • Enable Location Block, Address & Event Entities in CiviCRM Entity Settings page.
  • Ensure module weight for CiviCRM Entity is lower than Inline entity form.
drush ev 'module_set_weight("civicrm_entity", -10);'
  • Rebuild cache (drush cr) 2-3 times before proceeding for the next step.

  • Structure => CiviCRM Entity => CiviCRM Location block => Manage Form Display

  • Enable Address ID field and ensure Widget is set to Inline entity form. enter image description here

  • Similarly, enable Location Block ID field and set the widget to Inline entity form in Structure => CiviCRM Entity => CiviCRM Event => Manage Form Display

  • Visit the form at /civicrm-event/add to create events

Note: APIv3 requires contact_id and location_type_id field while creating address in civicrm. The former is not required while creating address for events so can be considered as an api bug.

Ensure these 2 fields are present on the Address entity to avoid any fatal error on the form submission.

enter image description here

1
  • Just a note that this does work to some extent, but you can't search for an existing address. The location block doesn't know any of the details of the address, so search isn't possible. Commented May 31 at 6:05

Your Answer

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

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