Jump to content

Checkbox Custom hook not working


picarica
 Share

Recommended Posts

Hello so am trying to make a hook so that all checkbox field is defaul;ty checked when making new page, soo i made hook in init.php and the contents are

<?php
$wire->addHookAfter("Pages::added", function($event) {
  $page = $event->arguments(0);
  // check for page template if necessary here
  $page->checkboxfield('check', 1);
});
?>

and what i get

Quote
  • PagesEditor: Error saving field "table" — Method Page::checkboxfield does not exist or is not callable in this context

which is weird because "table" is a repeat field where checkboxfield is nowhere present, but table repeat field and checkboxfield are in the same template, so why does it outputs error like that? any ideas ?

Link to comment
Share on other sites

Moderator note: this is not a module support thread, so I'm moving it to the General Support area of the forum instead. Please keep in mind that the Modules/Plugins area is only intended for module-specific support threads. Thanks!

 
 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...