Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Scaffold GridFieldFilterHeader filters for ArrayList based GridFields. #11575

Conversation

mfendeksilverstripe
Copy link
Contributor

@mfendeksilverstripe mfendeksilverstripe commented Jan 23, 2025

Description

Enables filtering capability for cases where GirdField data is stored in an ArrayList. This wasn't working before because pre CMS 5 such feature was not supported. With CMS 5 it's possible so we should enable it.

Issues

Likely replaces tractorcow-farm/silverstripe-fluent#922

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested yet, but a few (mostly minor) things stood out in a quick review

src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
@GuySartorelli
Copy link
Member

There is a failed unit test that seems relevant - can you please take a look?

1) SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest::testGetBasicSearchContext
We expect the search filters to be different as the filtering is different based on how data is provided to the GridField
Failed asserting that two arrays are not identical.

/home/runner/work/silverstripe-framework/silverstripe-framework/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php:339
/home/runner/work/silverstripe-framework/silverstripe-framework/vendor/bin/phpunit:122

@mfendeksilverstripe
Copy link
Contributor Author

Hey @GuySartorelli , have pushed up unit test fixes, CI is now green.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well locally, just one thing to fix

src/Forms/GridField/GridFieldFilterHeader.php Outdated Show resolved Hide resolved
@mfendeksilverstripe
Copy link
Contributor Author

Hey @GuySartorelli I've added your change, please review 🙏

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@GuySartorelli GuySartorelli merged commit 82fa0f0 into silverstripe:5 Jan 29, 2025
17 checks passed
@mfendeksilverstripe mfendeksilverstripe deleted the feature/array-list-filters branch January 29, 2025 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants