processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Selector no longer works on latest dev when using a toggle field

Open cb2004 opened this issue 1 year ago • 2 comments

This used to work:

$home = $pages->get(1);
$nav = $home->children('template!=51|52|62, toggleShowHide!=1');

But now if a page which is under the home does not have that field assigned to the template they do not show. I have had to change my selector to:

$nav = $home->children('template!=51|52|62, id!=INT|INT|INT');

Until this is rectified.

cb2004 avatar Feb 26 '24 12:02 cb2004

@cb2004 The toggle field is a bit unique in that it has distinct options for no-selection, no, yes and other. But I agree that it should match the way you mentioned. I've pushed an update to FieldtypeToggle adds support for matching no-selection for operator != on fields that lack the field, plus adds some other possibilities as well. Can you confirm this fixes it there?

ryancramerdesign avatar Feb 29 '24 17:02 ryancramerdesign

@cb2004 are you ok with Ryan's fix? Can you close this issue?

matjazpotocnik avatar Mar 24 '24 07:03 matjazpotocnik

@cb2004 ping

matjazpotocnik avatar May 29 '24 17:05 matjazpotocnik