-
Notifications
You must be signed in to change notification settings - Fork 7
Add optional query display name #573
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
base: trunk
Are you sure you want to change the base?
Conversation
Test this PR in WordPress Playground. |
@@ -156,6 +156,7 @@ private static function generate_generic_http_data_source_config_schema(): array | |||
|
|||
private static function generate_http_query_config_schema(): array { | |||
return Types::object( [ | |||
'display_name' => Types::nullable( Types::string() ), |
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.
Thoughts around making it mandatory? That way we don't need to worry about fallbacks, and it does force users to think about the purpose of the query.
This'll make some of the code I added in #530 redundant which is great as we shouldn't be generating that name ideally.
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 a breaking change. That's the main reason I made it nullable.
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.
That's a fair point, and I think I have a solution from it. We can leverage the migration framework that'll be introduced in #530 to generate the display name in the same way that the PR does already. That way, the nullable could be dropped while not breaking anything already existing.
This can happen in a follow up PR
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.
Never been so eager to review a PR such as this one
I don't know if this has been thought about yet, but how are we planning to use internationalization within the plugin? I guess display name is an easy one to start with, although if the input is via a user then maybe that isn't important to them, but it might be for end users if it's display somewhere user facing. |
We've thought about it a little:
|
Thanks! That makes sense - I wonder if we should provide an example of this? I'm more thinking around the use-case whereby the plugin is configured across many sites (maybe not via the plugin itself but some mu-plugin code), and these sites have different languages - we should help them in these scenarios somehow. |
I think 1 and 2 should solve for this, with some additional effort. I created VIPCMS-1316 to track this |
Queries do not currently accept a display name, but I believe a display name will be useful in the future. Asking for it now (optionally) might pay off in the future.