i erased everything to try again and i'm still getting that error when i try to install the module
here's the full code of saveShortUrl.module that i'm using:
<?php
class saveShortUrl extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Rewrite field after save',
'version' => 1,
'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.',
'href' => 'http://www.processwire.com',
'singular' => true,
'autoload' => true,
'icon' => 'smile-o',
);
}
public function init() {
// add a hook before the $pages->save, to issue a notice every time a page is saved
$this->pages->addHookBefore('save', $this, 'saveShortUrl');
}
/**
* Save as another field.
**/
public function saveShortUrl($event) {
$page = $event->arguments[0];
//#todo Rename to your field names.
$page->domain = parse_url($page->source_url,PHP_URL_HOST);
//#todo Maybe some more error handling.
$page->of(false);
$page->save("domain");
$this->message("Save the domain {$page->domain}.");
}
}
i'm using a field "domain" and a field "source_url"