Hi,
I'm not sure what I'm doing wrong here (Processwire 3.0.20), maybe it's just finding the right hook:
public function init() {
$this->pages->addHookAfter('saveReady', $this, 'adminFileAdded');
}
public function adminFileAdded(HookEvent $event) {
$page = $event->arguments(0);
$filesAdded = $page->files->getItemsAdded();
}
I've been getting an empty array when I add files to a page, it doesn't matter if I use save, saveReady, before and after.
Here's some more info:
1. I'm seeing the field files has changed when I call $page->getChanges();
2. $page->files->getItemsRemoved() shows the removed files correctly.
3. getItemsAdded() works correctly when I use a hook on Page::changed(files), but I still need to access the added items on the page save. this hook is called right after the upload, which I'm trying to avoid.
Any help is appreciated, thanks