Jump to content

Force/override hidden/empty fieldsets & fieldsetWrappers to show in admin


Recommended Posts

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. 

Screen Shot 2018-07-03 at 7.37.05 PM.png

Link to comment
Share on other sites

Testing with actual fields in the template (just for convenience, and will be the same for inputfields added dynamically with InputfieldWrapper::insertAfter(), etc)...

2018-07-04_150557.png.4ed92f81c13179097a03b60295316a1e.png

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.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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

2018-07-04_150557.png.4ed92f81c13179097a03b60295316a1e.png

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

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

  • 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...