Jump to content

How to add field of FieldtypeOptions via API???


hellomoto
 Share

Recommended Posts

I have a module that creates a bunch of fields and none of the Options type are saving their values. The options I have set appear in the page editor, however when I go to edit any of these fields the textarea where the options are supposed to be specified is blank. 


      $f = new Field();
      $f->set("name", "iu_do")->set("label","Action(s)");
      $f->type = wire('modules')->get('FieldtypeOptions');
      $f->set('inputfieldClass', 'InputfieldCheckboxes')->save();
      $f->options = [0 => "Import", 1 => "Update"];
      $f->set("required",1)->set("optionColumns",1);
      $f->set("tags","-impupd")->set("columnWidth",50)->save();

How do I do this right? Thank you.

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...