horst Posted June 17, 2016 Share Posted June 17, 2016 As the subject says. With the ModuleConfig, we can define our fields in the MyModuleConfig.php __construct() method with calling $this->add() and pass it an array with lots of field-definition arrays. This is working fine with fields on one level. But how can I organize them into fieldsets? I have tried a bit with multidim arrays, but no luck. Has anyone does this before? Is anyone using this "new" config method? (implemented in PW 2.5.5) Link to comment Share on other sites More sharing options...
Martijn Geerts Posted June 17, 2016 Share Posted June 17, 2016 Nope, sorry. For me that is to 'decoupled'. 1 Link to comment Share on other sites More sharing options...
horst Posted June 17, 2016 Author Share Posted June 17, 2016 Ah, great. I figured it out myself! We need to add all fields into a children array: $this->add( array( array( 'type' => 'Fieldset', 'name' => '_myfieldset', 'label' => 'Fieldset Label', 'collapsed' => Inputfield::collapsedYes, // Inputfield::collapsedNo 'children' => array( array( 'type' => 'select', 'name' => 'kit_type', 'label' => 'Select the Kit you are using', 'options' => array('uikit' => 'uikit'), 'required' => true, 'columnWidth' => 50, ), array( 'type' => 'text', 'name' => 'kit_fullpath', 'label' => 'directory site path to your kits scss sources', 'columnWidth' => 50, ) ), // close children ), // close fieldset //.. add more fields )); 4 Link to comment Share on other sites More sharing options...
horst Posted June 17, 2016 Author Share Posted June 17, 2016 Nope, sorry. For me that is to 'decoupled'. Hhhm, yes! For me it is it a bit too. But I thought to try it out and maybe it is lesser code to write. We will see how it goes. 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