From 8c24f7fb2984efa3a878e6b9a8890e9141117113 Mon Sep 17 00:00:00 2001
From: Seamus Lee <seamus.lee@jmaconsulting.biz>
Date: Fri, 20 Mar 2020 02:09:11 -0400
Subject: [PATCH] Trigger update of index if service listing is updated

---
 aoservicelisting.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/aoservicelisting.php b/aoservicelisting.php
index 5fa59b3..eb607a3 100644
--- a/aoservicelisting.php
+++ b/aoservicelisting.php
@@ -150,11 +150,15 @@ function aoservicelisting_civicrm_themes(&$themes) {
     if ($formName == "CRM_Contact_Form_Contact") {
       if (!empty($form->_contactId) && count(preg_grep('/^' . STATUS . '_[\d]*/', array_keys($form->_submitValues))) > 0) {
         E::setStatus($form->_contactId, $form->_submitValues);
+        $index = \Drupal\search_api\Entity\Index::load('default');
+        $index->trackItemsUpdated('entity:civicrm_contact', [$form->_contactId . ':und']);
       }
     }
     if ($formName == "CRM_Contact_Form_Inline_CustomData") {
       if (!empty($form->_submitValues['cid']) && count(preg_grep('/^' . STATUS . '_[\d]*/', array_keys($form->_submitValues))) > 0) {
         E::setStatus($form->_submitValues['cid'], $form->_submitValues);
+        $index = \Drupal\search_api\Entity\Index::load('default');
+        $index->trackItemsUpdated('entity:civicrm_contact', [$form->_submitValues['cid'] . ':und']);
       }
     }
   }
-- 
GitLab