joshuag Posted July 4, 2018 Share Posted July 4, 2018 Does anyone know of a way that I can hook into the processPageEdit module or Inputfield Module or something... so that I can force empty Inputfieldset and empty fieldsetTabOpen to render? I have been through the files ProcessPageEdit.module, InputfieldWrapper.module, etc. etc. I have really been searching. I even saw that inside repeaters there is a comment about adding an empty line break inside an otherwise empty inputfieldWrapper to force it to render. But I have been unable to reproduce this. I then tried just creating a module that would loop through the input fields in a field group, render them out, then I am using javascript to insert them into the correct location on the edit screen, but it's getting to be too much to handle this way. I literally, want to make a module that says, show empty fieldsets, tabs, and hidden fields in the edit screen. Hope this makes sense. I don't want to create custom markup or render them a different way. I want to know if it's possible to make a module to have these things actually render in the admin screen in the actual markup. Suggestions? Thanks in advance for the help. Link to comment Share on other sites More sharing options...
Robin S Posted July 4, 2018 Share Posted July 4, 2018 Testing with actual fields in the template (just for convenience, and will be the same for inputfields added dynamically with InputfieldWrapper::insertAfter(), etc)... Empty fieldset: renders fine. Empty fieldset tab: tab itself renders but not the tab content. Probably needs some inputfield contained within it even if that inputfield isn't visible. Try InputfieldHidden, or InputfieldMarkup with no markup and the skipLabelHeader option. 1 1 Link to comment Share on other sites More sharing options...
joshuag Posted July 4, 2018 Author Share Posted July 4, 2018 1 hour ago, Robin S said: Testing with actual fields in the template (just for convenience, and will be the same for inputfields added dynamically with InputfieldWrapper::insertAfter(), etc)... Empty fieldset: renders fine. Empty fieldset tab: tab itself renders but not the tab content. Probably needs some inputfield contained within it even if that inputfield isn't visible. Try InputfieldHidden, or InputfieldMarkup with no markup and the skipLabelHeader option. Thanks Robin, Link to comment Share on other sites More sharing options...
joshuag Posted July 5, 2018 Author Share Posted July 5, 2018 @Robin S Ok, thanks a lot for your help, this worked perfectly. I don't know why I didn't think of this after so much digging. Seems so simple hindsight. You literally just helped me remove a BUNCH of JS I didn't want in my application. Thanks a million. This worked for both tabs and regular fieldsets. (well I am doing it to all InputfieldWrappers). Here is what I used: // make inputfieldWrappers render by FORCE even if they are empty $this->addHookBefore('InputfieldWrapper::render', $this, 'inputfieldWrapperShim'); public function inputfieldWrapperShim($event){ $inputfieldWrapper = $event->object; $f = new InputfieldText(); $f->attr('id','-hidden-shim-'.rand()); $f->attr('name','-hidden-shim'); $f->attr('class','-hidden-shim'); $inputfieldWrapper->add($f); } For anyone wondering, I didn't use InputfieldMarkup because it's an InputfieldWrapper so we would end up being stuck in a loop forever. 2 Link to comment Share on other sites More sharing options...
netcarver Posted July 5, 2018 Share Posted July 5, 2018 Nice solution between you both. Thanks for posting. 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