\Drupal\views\Plugin\views\field\EntityOperations isn't setting click sortable to FALSE, so when you click sort on this field you see

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unknown' in 'order clause':

Two ways to fix this:
- Set 'click sortable' for 'operations' to FALSE in \Drupal\views\EntityViewsData::getViewsData
- Override function clickSortable() in \Drupal\views\Plugin\views\field\EntityOperations and make it return FALSE

I would argue for the second option, since there is no way this handler should ever be click sortable even if you want to reuse it in another Views data setting and would possible use a different setting for (or fail to set) 'click sortable'.

Setting to major because an exception is thrown.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lendude created an issue. See original summary.

Lendude’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
493 bytes

Patch that sets click sorting to FALSE on the handler, this still needs tests.

Status: Needs review » Needs work

The last submitted patch, 2: 2830196-2.patch, failed testing.

Lendude’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
2.6 KB
3.08 KB

And a test. Interdiff is the test-only patch.

The last submitted patch, 4: 2830196-4-TEST_ONLY.patch, failed testing.

nicrodgers’s picture

Status: Needs review » Reviewed & tested by the community

Replicated problem. Applied patch successfully, problem fixed. Code looks clean. Nice one!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: 2830196-4.patch, failed testing.

Lendude’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fail, back to RTBC

  • xjm committed 6fe1217 on 8.3.x
    Issue #2830196 by Lendude: Click sorting EntityOperations field leads to...

  • xjm committed 67f200c on 8.2.x
    Issue #2830196 by Lendude: Click sorting EntityOperations field leads to...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

This fix makes sense to me. Major is the appropriate priority according to https://www.drupal.org/core/issue-priority#major-bug since a user can trigger an exception through the UI, but it only affects administrative users in this one narrow circumstance.

I hesitated on adding Views UI to the existing handler test, but eh, it's probably okay.

Thanks @Lendude and @nicrodgers! Committed and pushed to 8.3.x and 8.2.x.

Status: Fixed » Closed (fixed)

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