Problem/Motivation

It seems when changing weights on /admin/config/search/search-api/index/[index_id]/sorts_widget/[sort_id] it is not respected when form is being rendered.

I'll provide a quick patch for that.

Also, the weights are not used in the admin table. It was sorting $sorts but rendering the $fields array, so the visual order didn't update.

Steps to reproduce

Proposed resolution

Make the rows follow the correct weights in the search page, and admin page.

Remaining tasks

User interface changes

API changes

Data model changes

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

ludo.r created an issue. See original summary.

ludo.r’s picture

And here's the patch.

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

ressa’s picture

Thanks @ludo.r your patch makes the sort take effect! Though I don't see the tabledraggers (tabledrag-cell's are set to display: none) ... I need to use the "Show row weights" option, and enter for example "-1" to get a field at the top. Do you see them?

I created an MR, since that's probably better for the further process. Perhaps we should try to restore the tabledraggers in this issue as well ... what do you think?

ressa’s picture

Status: Active » Needs work

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

peri22’s picture

I have rebased MR !6 onto 1.x and added a second commit.
I tested ludo.r's fix, and it works perfectly: the widget now correctly follows the saved weights (-5/0/5).
My second commit fixes a similar issue in the admin table. It was sorting `$sorts` but rendering the `$fields` array, so the visual order didn't update. This is now fixed, and the rows follow the correct weights.

@ressa, about the missing drag handles: I think this is caused by the core "Show row weights" setting. When this is active, Drupal hides the drag handles in the browser. Could you check if you see the same behavior on other draggable tables (like Manage fields)? The tabledrag library is definitely attached correctly on our page.

peri22’s picture

Status: Needs work » Needs review
ressa’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks for looking at this @peri22, your patch works perfectly, and the weight is taking effect both on the search page, and even also on the admin page. So this is ready :)

About the missing drag-icons, it seems to not be related to this issue, because I now see that they are missing under "Sorts widget", but also under "Sorts". But they are present under for example "Processors", so something strange is going on ... I'll try to dig some more to understand why it's happening.

peri22’s picture

Status: Reviewed & tested by the community » Fixed

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

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

Maintainers, credit people who helped resolve this issue.

peri22’s picture

Thanks for the review, @ressa! The MR is merged.

If you have time, could you also review #3267604: Base path duplicated for sites hosted in sub-directories (MR !9)? It is a small fix with a unit test.

ressa’s picture

Perfect @peri22, thanks for landing this issue!

I would love to help with the other issue, but I am not sure how to quickly set this up in DDEV, where Drupal is served out of a subfolder ...

ressa’s picture

@peri22 There are quite a few improvements since the latest version from December 2024, so perhaps a fresh release could be considered? I do understand if you prefer to wait the fourteen days, before the issue is automatically permanently Closed (fixed).

Another improvement I thought of for this module would be if it got security coverage and I created #3619631: Opt Search API Sorts Widget into Drupal’s security advisory policy.