Problem/Motivation

In a project I’m working on, we had a requirement to implement a dynamic filter for collections that updates instantly and reflects the latest data. I’m not sure if this will be useful for others, but I’m sharing my approach in case it might help. I’m open to any suggestions or feedback.

Summary

After reviewing the Widen API documentation (Collections API Reference), examining the module’s functionality, and finding the search prefix acn:(), I decided to build on the existing module to handle this as a feature.

Implementation Details

Method Addition in AcquiaDamClient:
I created a new function, getCollections, in the AcquiaDamClient class. This function retrieves the latest list of collections from the Widen API, ensuring the data is up-to-date.

CollectionFilter Plugin: I added a CollectionFilter filter plugin that dynamically fills filter options in getValueOptions directly from getCollections. This approach ensures that the filter options are always current, meeting our project’s requirement for real-time updates.

Issue fork acquia_dam-3484967

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ricardo garcía created an issue. See original summary.

rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Version: 1.1.0-beta5 » 1.1.x-dev
Status: Active » Needs review

Requesting review.

rajeshreeputra’s picture

@japerry do we need to add the collection filter in the view? and update hook for existing customers/users?

japerry’s picture

Yah, I think if it can be added to the view without messing up the other filters, then lets do that. Unfortunately that also means more review time needed VS just putting up the api calls in the current MR, which really is harmless since you'd intentionally want to use it.

rajeshreeputra’s picture

I understand your point, whoever wants to use the collection filter can simply add it to view, since not everyone may need it. Hence we can probably merge this without adding the collection filter in the view.

japerry’s picture

Status: Needs review » Fixed

Sounds good! Fixed.

rajeshreeputra’s picture

Status: Needs review » Fixed

For some reason, this issue remains in the review state. However, I am marking it as fixed.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ricardo garcía’s picture

I would appreciate receiving credits. Have a good day.