Jump to content

yuters

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by yuters

  1. With $page->getFormatted('title') I get this error: Notice: Array to string conversion in wire/modules/LanguageSupport/FieldtypeTextLanguage.module on line 69
  2. I'm having the same issue, it seems to only affect fields with language support. Which makes the ->title property an array containing ['data'], I'm trying other fields with language support, like a textarea, and they give the same error but are inaccessible through the ['data'] array key. I guess multiple languages are not yet supported on multi-instance.
  3. Thanks Ivan, yes I've tried that hook too with the same results, it doesn't matter if it's before or after "save" or "saveReady", the array is always empty. horst, what I'm trying to do is notify users about new files added to a specific page template. The problem with the hooks you provided is that they are called when I upload the file, not when I save the page. It has to be when the page is saved so we know all uploads are final. I just realized that even the top bar notifications when I save the page doesn't show what files have been added, but shows the files that have been deleted, so maybe there's actually no way to do this. For now I'm only notifying when the files field has been changed, but it would have been nice to have a list of new files easily. The only way I see around this is to keep an history of the files in the database and compare with the full new list (files->getItems())
  4. 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
×
×
  • Create New...