-
Notifications
You must be signed in to change notification settings - Fork 818
Theme Compatibility: Catch Twenty Twenty PHP warning #43520
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
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
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.
Seems reasonable, assuming there's nothing bad about calling get_theme_mod( 'accent_accessible_colors' )
before get_theme_mod( 'accent_hue_active' )
. Haven't tested though.
@@ -124,7 +125,7 @@ function twentytwenty_infinity_accent_color_css() { | |||
} | |||
', | |||
$color_info['content']['accent'], | |||
$color_info['content']['background'], | |||
$color_info['content']['background'] ?? '#fff', |
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.
Themes always set the other two, just not this one?
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 per-theme setting, so we don't care about other themes, but this theme sets defaults for the other two properties, yes:
https://github.com/wordpress/twentytwenty/blob/master/classes/class-twentytwenty-customize.php#L152
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.
Oh, duh, "projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php" 😅
We get over 10K of these notices every day on WP Cloud (about 10% of the total warning/error count):
It seems Twenty Twenty doesn't set this property by default:
https://github.com/wordpress/twentytwenty/blob/master/classes/class-twentytwenty-customize.php#L152
However, if some colors are set but the main background color is not, one gets the PHP notice.
Note that the current output CSS defaults to an empty value. I originally was going to set the fallback to
#f5efe0
, which is what clicking "default" in the Customizer uses, but instead I decided to match what the current behaviour (inheriting#fff
) to avoid annoying users with a potential unexpected color change.Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
theme_mods_twentytwenty
option)./wp-admin/options-reading.php
/wp-admin/admin.php?page=jetpack#/settings?term=infinite
/wp-admin/customize.php
In
trunk
one gets a warning each time the page is loaded.In the
fix/jetpack/twentytwenty_compat_warning
branch, the warning is avoided.