Jump to content

arnoson

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by arnoson

  1. I have the same Issue with MySQL 5.7.26. I'm trying to install an exported site profile with PW 3.0.123. Is there any solution that doesn't require changing my sql mode manually?
  2. Yes the $page->set() works! thank you very much
  3. Hello, I'm trying to do the following: When a user saves a page I want to populate some fields on the same page. For example: calculate the ratio of an image and save it in a hidden field. I've created a Module and populate the field in a beforeSave hook. But my manually populated field doesn't get saved. I guess I have to call $page->save() in order to save the field, but this would lead to an infinite loop. Because I populate the field in a beforeSave hook shouldn't the page save the field right after the execution of my hook? <?php class ItemHooks extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'item hooks', 'version' => 100, 'summary' => 'add item hooks to process items after beeing saved', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookBefore('save', $this, 'handleSave'); } public function handleSave($event) { $page = $event->arguments('page'); $fields = $page->fields; $field = $fields->get('hidden_field'); $field->set('value', 'test'); $fields->save($field); } } ?> thanks, Arno
×
×
  • Create New...