From 1aa7c404dae63c9518468fe9b579fad819f8d871 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 13 Sep 2026 18:32:43 +0000
Subject: [PATCH] =Single Event page setup done through the new Event block. Currently working on the Simple Calendar block setup
---
inc/integrations/SyncHelpers.php | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/inc/integrations/SyncHelpers.php b/inc/integrations/SyncHelpers.php
index 778902a..84f5303 100644
--- a/inc/integrations/SyncHelpers.php
+++ b/inc/integrations/SyncHelpers.php
@@ -3,6 +3,7 @@
use JVBase\managers\queue\executors\IntegrationExecutor;
use JVBase\managers\queue\mergers\DefaultMerger;
+use JVBase\managers\queue\Queue;
use JVBase\managers\queue\TypeConfig;
use JVBase\meta\Meta;
use WP_Query;
@@ -23,12 +24,15 @@
protected static string $syncCustomer;
protected static string $import;
+ protected static array $syncing = ['posts' => [], 'users' => [], 'terms' => []];
+
protected function setQueueTypes():void
{
self::$syncTo = $this->service_name.'_sync_to';
self::$deleteFrom = $this->service_name.'_delete_from';
self::$syncFrom = $this->service_name.'_sync_from';
+ self::$syncCustomer = $this->service_name.'_sync_customer';
//TODO: What is the difference between sync_from and import?
self::$import = $this->service_name.'import_from';
}
@@ -42,6 +46,17 @@
default => ''
};
}
+ public function setServiceItemID(int $itemID, string $id, string $type = 'post'):bool
+ {
+
+ $result = match($type) {
+ 'post' => Meta::forPost($itemID)->set("_{$this->service_name}_item_id", $id),
+ 'term','taxonomy' => Meta::forTerm($itemID)->set("_{$this->service_name}_item_id", $id),
+ 'user' => Meta::forUser($itemID)->set("_{$this->service_name}_item_id", $id),
+ default => false
+ };
+ return $result !== false;
+ }
protected function updateItemStatus(int|array $items, string $status = 'pending', string $type = 'post'):void
{
if (!is_array($items)) {
@@ -151,7 +166,7 @@
if (empty($this->syncTaxonomies) && empty($this->syncPostTypes)) {
return;
}
- $queue = JVB()->queue();
+ $queue = Queue::getInstance();
$executor = new IntegrationExecutor();
$queue->registry()->register(self::$syncTo, new TypeConfig(
@@ -179,13 +194,17 @@
$this->registerAdditionalQueueTypes($executor);
}
- protected function registerAdditionalQueueTypes(IntegrationExecutor $executor):void
- {
- //Empty. Integration extensions can register additional operation types from here.
- }
/**
- * @return void Sets the $this->contentTypes
+ * Empty. Integration extensions can register additional operation types here
+ * @param IntegrationExecutor $executor
+ * @return void
+ */
+ protected function registerAdditionalQueueTypes(IntegrationExecutor $executor):void {}
+
+ /**
+ * @return void Sets the $this->contentTypes, which is an array of TYPE => [$fields]
+ * Should probably set the endpoints here as well, which would be an array of [ TYPE => [ 'create' => '','update' =>'', 'delete'=>'', 'batchCreate'=>'','batchUpdate'=>'', 'batchDelete'=>''] endpoints
*/
abstract protected function setContentTypes():void;
}
--
Gitblit v1.10.0