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

New: Enhance API endpoint to support additional filters #7285

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

pulsovi
Copy link
Contributor

@pulsovi pulsovi commented Mar 10, 2024

New: Enhance API endpoint to support additional filters

Resolves #7484

Description

Enhances the Give\Donations\Endpoints\ListDonations API endpoint to support additional filters, providing the necessary hooks for compatibility with third party add-ons / snippets.

The main goal is to extend the flexibility of the Donations\ListTable in the admin interface, allowing for the integration of new filters, such as filtering donations by donor ID.

Affects

Admin List Tables

Visuals

N/A

Testing Instructions

Tests already included in PR : see tests/Unit/Donations/Endpoints/TestListDonations:testShouldAllowAddingFilters

To test the new hooks and extension points, add some JavaScript code on the front-end page (via a snippet):

document.addEventListener("DOMContentLoaded", () => {
    wp.hooks.addFilter('give-donations-list-table-filters', 'namespace', filters => {
        return [
            ...filters,
            {
                name: 'donor',
                type: 'search',
                text: 'Donor',
                ariaLabel: 'Search by Donor'
            },
        ];
    });
});

Go to the back office > Give > Donations, new filter input added for Donor ID, lastname or firstname.

To allow using filters that are not already managed by ListDonations

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • [-] Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Apr 25, 2024
@github-actions github-actions bot removed the Stale label Aug 5, 2024
@pulsovi pulsovi force-pushed the filter/make-list_table-extendable branch from 3579553 to b4f5184 Compare August 5, 2024 13:05
@pulsovi pulsovi marked this pull request as draft August 9, 2024 09:07
@pulsovi pulsovi changed the title New Feat: Admin List Tables - allow third party plugin to add filters New: Enhance API endpoint to support additional filters Aug 9, 2024
@pulsovi pulsovi force-pushed the filter/make-list_table-extendable branch from b6d9e43 to eeac823 Compare August 9, 2024 11:57
@pulsovi pulsovi marked this pull request as ready for review August 9, 2024 12:00
Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance API endpoint to support additional filters
1 participant