Skip to content

Commit a4f1bd6

Browse files
herbdooljmcclelland
authored andcommitted
Issue fuzionnz#3: skip if CiviCRM processing off
1 parent c4fbcae commit a4f1bd6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/EventSubscriber/WebformCivicrmMigrateSubscriber.php

+8
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ public function migrateWebform(\Drupal\migrate\Row $row) {
482482

483483
public function migrateCiviCRMSettings($data, $default_settings) {
484484
$settings = $default_settings;
485+
// Skip if no contacts (unlikely but possible).
486+
if (empty($data['contact'])) {
487+
return $settings;
488+
}
485489
$settings['number_of_contacts'] = count($data['contact']);
486490

487491
if (!empty($data['contact'])) {
@@ -533,6 +537,10 @@ public function addCiviCRMHandler(Webform $webform, int $nid) {
533537

534538
# Get the data from the source webform.
535539
$webformData = WebformCivicrmMigrateSubscriber::getWebformCiviCRMData($nid);
540+
// Skip if CiviCRM processing was turned off.
541+
if (empty($webformData)) {
542+
return;
543+
}
536544

537545
# Create a handler
538546
$manager = \Drupal::service('plugin.manager.webform.handler');

0 commit comments

Comments
 (0)