[Code] Specialist Posted April 9, 2016 Share Posted April 9, 2016 Hi Folks, I like to develop a Backend Module with extra tabs and nested fields. Is there any Example Code for my Idea ? The Module should create new fields, a new Tab and several fields on it. AND... Last but not least the fields depend on each other by rules like "if checkbox $a then unfold area with Textfield 1+2 " If someone have a snippet for me to learn ... it would be soooo great. Thanks. Michael Link to comment Share on other sites More sharing options...
teppo Posted April 9, 2016 Share Posted April 9, 2016 (edited) Probably better examples floating around too, but the execute() method in ProcessLinkChecker.module loads JqueryWireTabs, creates a new InputfieldWrapper, and adds child inputfields. In this case children are created by separate build* methods, but you could also create them in the execute() method itself. In this case I need to create multiple similar inputfields, and separate methods help me avoid code repetition. There might be a better way to do this, but in this case I had to trigger the tab feature myself. This is done in ProcessLinkChecker.js, and the target is the original InputfieldWrapper element created by execute() method of ProcessLinkChecker.module. This is why I had to load JqueryWireTabs in the Process module, by the way. You can display fields conditionally by using showIf rules. Something like this, perhaps: public function execute() { $fields = new InputfieldWrapper; $field = new InputfieldCheckbox; $field->name = "field_a"; $fields->add($field); $field = new InputfieldText; $field->name = "field_b"; $field->showIf = "field_a=1"; $fields->add($field); return $fields->render(); } Edit: I'm moving this topic to module development subforum. Modules forum is intended for module support threads, while the module development subforum is where we can discuss development practices etc. Edited April 9, 2016 by teppo 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