Jake Vanderwerf
2026-08-28 5b50afdcafd150186ea5c7b0e1cad98065590b35
inc/registrar/helpers/AddIntegrationFields.php
@@ -1,6 +1,7 @@
<?php
namespace JVBase\registrar\helpers;
use JVBase\integrations\ServiceMap;
use JVBase\registrar\config\Integration;
use JVBase\registrar\Registrar;
use JVBase\base\Site;
@@ -10,6 +11,7 @@
}
class AddIntegrationFields {
   use ServiceMap;
   protected string $service_name;
   private Registrar $registrar;
   protected Integration $config;
@@ -65,8 +67,9 @@
   public function getIntegrationFields():array
   {
      if ($this->registrar && $this->registrar->getType() === 'user' && $this->config->isCustomer()) {
         return JVB()->connect($this->service_name)->getAdditionalFields('customer');
      if (!$this->getService($this->service_name)) {
         error_log('Attempted to connect to unsupported service: '.$this->service_name);
         return [];
      }
      $fields = [
         'share_to_'.$this->service_name => [
@@ -123,7 +126,7 @@
      }
      if ($this->config->getCanSchedule()) {
         $fields['schedule_'.$this->service_name] = [
         $fields['_'.$this->service_name.'_scheduled_at'] = [
            'type'   => 'datetime',
            'label'  => 'Schedule for later?',
            'condition' => [
@@ -134,8 +137,13 @@
            'default'   => 1,
         ];
      }
      $additional = JVB()->connect($this->service_name)->getAdditionalFields($this->config->getContentType());
      $additional = $this->getService($this->service_name)->getAdditionalFields($this->config->getContentType());
      if (!empty($additional)) {
         $additional = array_combine(
            array_map(fn($k) => str_starts_with($k, '_'.$this->service_name) ? $k : "_{$this->service_name}_{$k}", array_keys($additional)),
            $additional
         );
         $fields = array_merge($fields, $additional);
      }
      return $fields;