Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Dec 2014 at 21:16 UTC
Updated:
4 Oct 2021 at 17:00 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
jhedstromComment #3
sam152 commentedFunctionality works as advertised. +1 to RTBC.
Comment #4
olli commentedWhy not make all fields that use sort also "click sortable"?
Comment #5
jhedstromRe: #4 I added this logic:
for a reason that I can't remember now. Simply making all fields here click-sortable resulted in SQL errors for certain fields.
Comment #6
idebr commentedThe original issue #1891036: Make 'click sortable' default to TRUE as well as the change record #1895020: 'click sortable' = TRUE is now standard in views data suggest that
click sortabledefaults toTRUE. However Field::clickSortable() is still disables click sorting by default:Should this patch not be the other way around?
Field::clickSortable()toreturn TRUEclick sortablefor incompatible fieldsThis probably belongs in the field.module component.
Comment #7
jhedstromInteresting, I hadn't seen the logic mentioned in #6 while working on this. I'll work on reversing the logic here and make a slight adjustment to the
Field::clickSortable()method.Given #2399931: Generic entity api field handler should live in views module not in field module, I think the views.module component still makes sense for this issue.
Comment #8
jhedstromAh! Re #4. Working on this now I remembered why this was needed:
Adding 'click sorting' for all columns that are deemed sortable doesn't work here because the 'field' array is only defined for the
$field_name(this function is incredible complex/confusing).Comment #9
jhedstromThis defaults
Field::clickSortableto only return false if click sorting is explicitly disabled.Comment #10
jhedstromAnd a non-empty patch.
Comment #11
damiankloip commentedOverall, looks fine. Setting
Can we just make this simpler while we are here?
and just return it if it's set? what do you think?
This comment seems weird, maybe "Set click sortable for.." or remove the part about table displays.
Comment #12
damiankloip commentedAlso, in this context, isn't 'real field' always going to get set? So this could just live with the rest of the definition?
Comment #13
jhedstromThis should address #11.
Regarding #12, I don't think it is always set, or if it is, there isn't always a field definition at that level. I've changed the patch to what I think is actually supposed to happen here (eg, check if there is a field definition).
Comment #14
dawehner+1 The new patch makes more sense.
Moved to major, as it will be even more important in the future (#2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency)
Comment #15
tim.plunkettComment #16
dawehnergood spot @tim.plunkett !
Comment #18
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #20
liquidcms commentedNot sure if anyone sees closed issues; but trying to sift through this to see why it breaks Link fields from being click sortable (even though the field config allows you to pick which part of the field this is sorted on). Hard to believe this has been missed all these years.
I posted the bug here: #3239705: Link fields are not click-sortable in Views tables