-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
Description
Short description of the issue
In earlier versions of PW the full range of options were available for the Visibility > Presentation setting for FieldtypeFieldsetOpen fields.
The screenshot below is from PW 3.0.118
At some point many of these options were removed from InputfieldWrapper, which InputfieldFieldsetOpen extends.
But the four options relating to blank/populated are useful and they seem to work fine with FieldtypeFieldsetOpen. If I restore those options with the hook below...
$wire->addHookAfter('InputfieldFieldsetOpen::getConfigInputfields', function(HookEvent $event) {
$inputfield = $event->object;
$wrapper = $event->return;
// Not for InputfieldFieldsetTabOpen
if($inputfield instanceof InputfieldFieldsetTabOpen) return;
$f = $wrapper->getChildByName('collapsed');
if(!$f) return;
// Add back the blank/populated options that were removed by InputfieldWrapper::getConfigInputfields
$f->addOption(Inputfield::collapsedBlank, $this->_('Open when populated + Closed when blank'));
if($inputfield->hasFieldtype !== false) {
$f->addOption(Inputfield::collapsedBlankAjax, $this->_('Open when populated + Closed when blank + Load only when opened (AJAX)') . " †");
}
$f->addOption(Inputfield::collapsedBlankLocked, $this->_('Open when populated + Closed when blank + Locked (not editable)'));
$f->addOption(Inputfield::collapsedPopulated, $this->_('Open when blank + Closed when populated'));
});...then the fieldset can be automatically collapsed or not based on whether the child fields are populated.
Seeing as this works, was the removal for FieldtypeFieldsetOpen unintended? Can support for these visibility settings be added back please?
Setup/Environment
- ProcessWire version: 3.0.240

