Jake Vanderwerf
2026-09-15 01e9a8e40351a87f6548a4f55de842d6f6918ad0
inc/meta/Group.php
@@ -16,7 +16,7 @@
   {
      $this->meta = $meta;
      $this->name = $name;
      $this->config = $meta->config($name) ?? [];
      $this->config = $meta->getFieldConfig($name) ?? [];
      $data = $meta->get($name);
      $this->data = is_array($data) ? $data : [];
@@ -44,12 +44,11 @@
      return $this->getPath($nested, $fieldConfig['fields'] ?? [], $parts);
   }
   public function set(string $path, mixed $value, bool $autosave = true): self
   public function set(string $path, mixed $value, bool $autosave = true): bool
   {
      $parts = explode('|', $path);
      $parts = explode('|', $path, 2);
      $this->setPath($this->data, $this->config['fields'] ?? [], $parts, $value);
      $this->sync($autosave);
      return $this;
      return $this->sync($autosave);
   }
   protected function setPath(array &$data, array $fieldsConfig, array $parts, mixed $value): void
@@ -83,7 +82,7 @@
         }
         $this->data[$field] = $value;
      }
      $this->sync(true);
      $this->sync();
      return $this;
   }
@@ -97,8 +96,9 @@
      return isset($this->config['fields'][$field]);
   }
   protected function sync(bool $autosave = true): void
   protected function sync(bool $autosave = true): bool
   {
      $this->meta->set($this->name, $this->data, $autosave);
      error_log('Setting '.$this->name.' group with data: '.print_r($this->data, true));
      return $this->meta->set($this->name, $this->data);
   }
}