-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataViews: Fix author sorting in templates and template parts #58167
Conversation
Size Change: +1 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@@ -374,7 +374,7 @@ export default function PageTemplatesTemplateParts( { postType } ) { | |||
data: filteredData, | |||
view, | |||
fields, | |||
textFields: [ 'title' ], | |||
textFields: [ 'title', 'author' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can work for now, but we could follow-up to do the following:
- add
text
type to fields - remove
textFields
fromsortByTextFields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I look at this utility, sortByTextFields
can probably become sortByField
with more type field info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that straightforward right now because author
is an type:enumeration
. Maybe we could explore if we could use getValue
for those fields too, but we would need to think of what other use cases we could have..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with removing textFields
. It's true that not all enums behave like regular text fields, but we can approach this more generally. Also, is sort-by-author currently sorting by the username? What about display name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For templates and template parts we use the author_text, which is a custom implementation due to the different kind of authors. For example for theme items the actual persisted value in db is author:0
, but we extract the theme name as author.
What?
Fixes: #57978
Testing Instructions