Jump to content

Using tabs (WireTabs) in a module config


Robin S
 Share

Recommended Posts

  • 7 months later...
1 hour ago, MarkE said:

InputfieldWrapper is not a module AFAIK - at least in my v 3.0.165

InputfieldWrapper extends Inputfield which implements Module.

2021-08-18_122421.png.e5186d4600b6c24793abc8dce5578a21.png

Do you get an error or something when you install this example module?

Link to comment
Share on other sites

49 minutes ago, netcarver said:

This requires a more recent version of PW than 3.0.165 - I'm currently using 3.0.182.

Ta. The site is on 3.0.165. @Robin S's module is on 170. Hopefully a new core is out soon and I will move to that.

However, I am using this in my ProcessDbMigrate module (full alpha release shortly.... ?) and I have tried to make that compatible with 3.0.148 (even pre page class days). I'm not sure what the best policy is regarding the backwards compatibility of new modules.

Link to comment
Share on other sites

For the benefit of anyone else wanting their module to be comptible with earlier versions of PW, I suggest you use: 

$tab1 = $this->wire(new InputfieldWrapper());

not

$tab1 = $modules->get('InputfieldWrapper');

Also, do not use plain $tab1 = new InputfieldWrapper(); as the column widths of the contained inputfields will not work properly. Per the PW coding style guide:

Quote

All newly-created objects that are derived from Wire SHOULD have their dependencies injected. In order to do this, pass the new object through the wire() method.

 

  • Like 2
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...