Jake Vanderwerf
5 days ago 0dfe1d8afafc59c4a5559c498342668d5a58d6ef
inc/registrar/helpers/AddIntegrationFields.php
@@ -65,14 +65,12 @@
   public function getIntegrationFields():array
   {
      if ($this->registrar && $this->registrar->getType() === 'user' && $this->config->isCustomer()) {
         return JVB()->connect($this->service_name)->getAdditionalFields('customer');
      }
      $fields = [
         'share_to_'.$this->service_name => [
            'type'   => 'true_false',
            'label'  => 'Share To '.$this->allowed[$this->service_name],
            'section'   => 'sync',
            'default'   => 1
         ]
      ];
      if ($this->config->getUpdate()){
@@ -84,7 +82,8 @@
               'field'  => 'share_to_'.$this->service_name,
               'value'  => 1,
               'operator'  => '=='
            ]
            ],
            'default'   => 1,
         ];
         $fields["_{$this->service_name}_item_id"] = [
@@ -121,18 +120,23 @@
      }
      if ($this->config->getCanSchedule()) {
         $fields['schedule_'.$this->service_name] = [
         $fields['_'.$this->service_name.'_scheduled_at'] = [
            'type'   => 'datetime',
            'label'  => 'Schedule for later?',
            'condition' => [
               'field' => 'share_to_'.$this->service_name,
               'operator' => '==',
               'value' => 1
            ]
            ],
            'default'   => 1,
         ];
      }
      $additional = JVB()->connect($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;