Skip to content

Evaluate InputfieldRepeater::isEmpty() differently when inputfield is in $singleMode (FieldsetPage) #533

@Toutouwai

Description

@Toutouwai

Short description of the enhancement

FieldsetPage uses InputfieldRepeater for its inputfield, but it sets a special $singleMode that affects several things.

Something else that it would be good for $singleMode to do is change the behaviour of InputfieldRepeater::isEmpty().

A normal repeater can have zero items or many items, and so it makes sense that in normal mode isEmpty() will return a value based on the count of the repeater items.

But FieldsetPage always has one item, so InputfieldRepeater::isEmpty() doesn't do anything useful for FieldsetPage - it always returns false. When $singleMode is true it would be better if InputfieldRepeater::isEmpty() returned true when none of the fields within the FieldsetPage are populated and false when any of them are populated.

That would allow the "when blank/populated" visibility settings for the inputfield to work, as they currently don't work for FieldsetPage. Related forum topic: https://processwire.com/talk/topic/22666-visibility-fieldset-page/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions