- Issue created by @aaronpinero
- πΊπΈUnited States aaronpinero
I created a new branch for this modification and implemented the following:
- Updated the config/schema for the module to add mapping for the sortrules array.
- Updated the SearchApiEndpoint entity and the SearchApiEndpointInterface to add a new sortrules property and a getSortRules() function to retrieve the saved sortrules values.
- Updated the SearchApiEndpointForm to add fields for specifying one or more sortrules.
- Updated the SearchApiEndpointController to apply the sortrules when building the API response.
- Provided some styling for the SearchApiEndpointForm
I my changes, I have not removed the previous default_sort and default_order properties of the entity. I have also not removed the related interface functions or form fields. This was just to see if I could get this to work and it does appear to work in limited testing.
These changes will cause a problem for the UI elements if someone is using those submodules. I'm not using those submodules, but I've inspected the code enough to know that the changes I am making would break something further down the line.
But it's a start.
- πΊπΈUnited States aaronpinero
If anyone wants to try this modification, I am going to add a .patch file. I've successfully applied this patch file using composer to test the new setting of multiple sort rules.
- πΊπΈUnited States aaronpinero
To use the new multiple sort options, you modify an existing endpoint (which is what I did) after patching the module. When you go to the edit form for the endpoint, you will see a new fieldset at the bottom of the form for Sort Rules.
This screenshot shows my endpoint with some sort rules already provided. You can remove sort roles with the remove buttons or add a new sort rule with the add button. The sort rules will be applied in the order shown.
- Merge request !31Draft: handle display of previously saved sort rules; improve saving sort rules; add... β (Open) created by a.dmitriiev
- π©πͺGermany a.dmitriiev
The changes look good so far. I will need to verify how they work together with UI module. Definitely it should be possible to change the sorting with query parameter even if the default sorting rule(s) are set. But it is a very good start. I have opened the MR so that it is easier to see and review the changes.
Thanks @aaronpinero !
- π©πͺGermany a.dmitriiev
I have rebased the branch, as predefined filters functionality from β¨ Add pre-configurable filters to endpoint Active was merged in already.