Abe Cube Posted December 14, 2021 Share Posted December 14, 2021 <?php namespace ProcessWire; class TabExtension extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Foo test module', 'summary' => 'An example of creating a module', 'version' => 1, 'summary' => 'Display message when pages are saved', 'autoload' => true, ]; } public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); } public function addButtons($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $tab = new InputfieldWrapper(); $tab->attr('title', 'Settings'); $tab->attr('class', 'WireTab'); $markup = $this->modules->get('InputfieldMarkup'); $markup->label = 'Settings'; $markup->value = '<p>Just a placeholder for some inputfields.</p>'; $tab->add($markup); $inputfields->add($tab); $form->add($inputfields); } } } Link to comment Share on other sites More sharing options...
Abe Cube Posted December 14, 2021 Author Share Posted December 14, 2021 And this is the message, which is on the top of my module. Module class must implement the “ProcessWire\Module” interface. Link to comment Share on other sites More sharing options...
BitPoet Posted December 14, 2021 Share Posted December 14, 2021 Are you sure you uploaded the correct file? There's no mention of TabButton anywhere in your code, after all. 1 Link to comment Share on other sites More sharing options...
horst Posted December 14, 2021 Share Posted December 14, 2021 @Abe Cube please use the code input to post code: Example: <?php namespace ProcessWire; class TabExtension extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Foo test module', 'summary' => 'An example of creating a module', 'version' => 1, 'summary' => 'Display message when pages are saved', 'autoload' => true, ]; } public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); } public function addButtons($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $tab = new InputfieldWrapper(); $tab->attr('title', 'Settings'); $tab->attr('class', 'WireTab'); $markup = $this->modules->get('InputfieldMarkup'); $markup->label = 'Settings'; $markup->value = '<p>Just a placeholder for some inputfields.</p>'; $tab->add($markup); $inputfields->add($tab); $form->add($inputfields); } } } 2 Link to comment Share on other sites More sharing options...
Abe Cube Posted December 14, 2021 Author Share Posted December 14, 2021 Thank you BitPoet for your reply. Yes I uploaded the correct file. TabExtension and TabButton are two different modules but for both of them I got the same error message. I accidently posted the wrong pic for my code, but the error messages are similar. Link to comment Share on other sites More sharing options...
adrian Posted March 26 Share Posted March 26 @Abe Cube - I know this is very old, but perhaps it will help someone else. I just had this same error and it turns out is was due to a mismatched class name and file name. I was testing something and my file was a typo: ProcessHiddenPageText.module.php while the class name was the correct ProcessHiddenPageTest.module.php As soon as I fixed the filename and did a modules refresh, everything worked as expected. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now