Hi,
I created a basic plugin for including the body field from other pages with a special syntax. However, I can't find the module in the "Text Formatters" list. Can you help me identify what I did wrong? Thank you.
<?php
/**
* ProcessWire Include Other Page Module
*/
class IncludeOther extends Textformatter {
public static function getModuleInfo() {
return array(
'title' => 'Include Other Page',
'version' => 100,
'summary' => "Includes Other Pages",
);
}
public static function content_from_id($matches) {
$id = $matches[1];
return wire('pages')->get($id)->body;
}
public function format(&$str) {
$str = preg_replace_callback("/\[\[([0-9]+)\]\]/", $this->content_from_id, $str);
}
}
?>