-
Notifications
You must be signed in to change notification settings - Fork 128
Implement basic settings for View Transitions plugin #2025
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #2025 +/- ##
==========================================
- Coverage 70.01% 68.05% -1.96%
==========================================
Files 91 92 +1
Lines 7603 7622 +19
==========================================
- Hits 5323 5187 -136
- Misses 2280 2435 +155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
function plvt_render_settings_field( array $args ): void { | ||
$option = plvt_get_stored_setting_value(); | ||
|
||
switch ( $args['field'] ) { |
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.
There's also no guarantee that $args['field']
is defined. If not set, perhaps this should short-circuit if the expected array keys aren't defined?
switch ( $args['field'] ) { | |
if ( ! isset( $args['field'], $args['label_for'], $args['field'], $args['description'] ) ) { | |
return; | |
} | |
switch ( $args['field'] ) { |
Granted, this is highly unlikely.
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.
There's no guarantee from a PHP perspective, but isn't it required at least from a PHPStan perspective due to how the @param
is defined? Also it's worth noting this is a private function, so that plus the PHPStan annotation might make this unnecessary.
On the other hand, of course it's good for defensive coding. In that case though, I think we should only bail for field
and label_for
missing, since description
is optional in the first place - if it's not set, we should just not render a description.
Co-authored-by: Weston Ruter <[email protected]>
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.
LGTM
… each individual input field.
Summary
See #1997: This adds basic settings to control the theme support arguments for the View Transitions plugin.
Relevant technical choices
add_theme_support( 'view-transitions', $args )
.! defined( 'ABSPATH' )
check was added to all plugin files where it was missing.Note: Most of the code is inspired by the relatively similar settings implementation for the Speculative Loading plugin. In fact, I copied that code over as a starting point.
Settings UI Screenshot