In the Node view wizard, the default sort for Title is descending (should be ascending).

This is provided by \Drupal\node\Plugin\views\wizard\Node::getAvailableSorts():

    return array(
      'node_field_data-title:DESC' => $this->t('Title')
    );
 

It should be ASC not DESC for the default sort direction for the node titles. Sorting in reverse alphabetical order makes no sense at all, so anyone who uses this in the wizard would need to change the direction, most likely.

Should be a one-line patch, unless there is some kind of a test out there that is depending on this strange behavior, so I have marked this as a Novice issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon created an issue. See original summary.

vpshah86’s picture

Assigned: Unassigned » vpshah86
vpshah86’s picture

Assigned: vpshah86 » Unassigned
Status: Active » Needs review
FileSize
957 bytes

Hi @jhodgdon

Adding the patch file for node sorting by ASC.

Please review it.

Thanks

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That does look like the right patch.

I also applied it, and tested manually by making a view using the Node wizard, using the sort labeled "Title" in the wizard. It came out with the titles sorted alphabetically (ascending), not descending as it previously did.

I am assuming since this behavior was apparently previously not tested, maybe it hasn't been deemed important to test... In an automated test, you don't select things from drop-down Select lists using their UI title anyway, but the internal string, so someone writing the test would have immediately known it was wrong (that is actually how I noticed it, since I was writing a test for the User Guide and the test had to put this "node_field_data-title:DESC" string in for the value when it submitted the wizard form)... anyway I will go ahead and mark this as RTBC and if the maintainers decide it needs a test, they can act accordingly.

Thanks!

Status: Reviewed & tested by the community » Needs work
jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

Seems to have been an aborted test in there. Most recent result is Passed.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks! Agreed this doesn't need a test.

  • catch committed bf91988 on 8.3.x
    Issue #2782323 by vpshah86, jhodgdon: Node views wizard has wrong sort...

  • catch committed 1be63e1 on 8.2.x
    Issue #2782323 by vpshah86, jhodgdon: Node views wizard has wrong sort...

Status: Fixed » Closed (fixed)

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