-
Notifications
You must be signed in to change notification settings - Fork 840
Add platform config #45874
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?
Add platform config #45874
Conversation
|
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. |
| Are you an Automattician? The PR will need to be tested on WordPress.com. This comment will be updated with testing instructions as soon the build is complete. |
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.
Pull Request Overview
This PR introduces a platform configuration system to control Jetpack branding display throughout the UI. It adds three new filters (jetpack_accent_colour, jetpack_has_branding, and jetpack_has_subtle_branding) that allow platforms like WordPress.com to customize or remove Jetpack branding elements.
Key Changes:
- Centralized the
getIconColor()function and moved it from individual packages to@automattic/jetpack-shared-extension-utils - Added new platform configuration data structure with accent color and branding visibility settings
- Implemented conditional rendering of Jetpack logos in block categories and form components based on branding settings
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
projects/packages/assets/src/class-script-data.php |
Adds platform configuration data including accent color and branding flags, with three new filter hooks |
projects/js-packages/script-data/src/utils.ts |
Implements helper functions accentColour(), hasBranding(), and hasSubtleBranding() to access platform configuration |
projects/js-packages/script-data/src/types.ts |
Defines TypeScript types for the new PlatformData interface |
projects/js-packages/shared-extension-utils/src/get-icon-color.js |
Refactors to use centralized accentColour() function from script-data |
projects/js-packages/shared-extension-utils/src/block-icons.js |
Refactors to use centralized accentColour() function, removing duplicate logic |
projects/plugins/jetpack/extensions/shared/block-category.js |
Conditionally displays Jetpack branding in block collections and categories based on platform settings |
projects/packages/forms/src/dashboard/components/layout/index.tsx |
Conditionally renders Jetpack logo in Forms dashboard header based on subtle branding setting |
projects/packages/forms/src/blocks/*/index.js (multiple) |
Updates import paths to use centralized getIconColor from shared-extension-utils |
projects/packages/forms/src/blocks/shared/util/block-icons.js |
Removes duplicate getIconColor implementation in favor of centralized version |
| Various changelog files | Documents the changes across affected packages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Significance: minor | ||
| Type: other | ||
|
|
||
| This is more internally relavent |
Copilot
AI
Nov 11, 2025
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.
Typo in changelog: "relavent" should be "relevant".
| if ( isWpcomPlatformSite() ) { | ||
| // Return null to match core block styling | ||
| return null; | ||
| } | ||
| return getPlatformData()?.accent_colour || '#069e08'; // Jetpack green as default. |
Copilot
AI
Nov 11, 2025
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.
The logic for returning accentColour has a potential issue. When isWpcomPlatformSite() returns true, the function returns null to match core block styling. However, this bypasses the filter jetpack_accent_colour entirely for WordPress.com sites. If the intent is to allow WordPress.com sites to still use the filter to set a custom accent color, this early return prevents that. Consider checking the platform data first before deciding to return null.
| if ( isWpcomPlatformSite() ) { | |
| // Return null to match core block styling | |
| return null; | |
| } | |
| return getPlatformData()?.accent_colour || '#069e08'; // Jetpack green as default. | |
| const accentColour = getPlatformData()?.accent_colour; | |
| if ( accentColour ) { | |
| return accentColour; | |
| } | |
| if ( isWpcomPlatformSite() ) { | |
| // Return null to match core block styling if no custom accent color is set | |
| return null; | |
| } | |
| return '#069e08'; // Jetpack green as default. |
| * | ||
| * @since $$NEXT_VERSION$$ | ||
| * | ||
| * @param string $colour The accent colour in HEX format. |
Copilot
AI
Nov 11, 2025
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.
The filter documentation specifies the parameter as @param string $colour The accent colour in HEX format. which suggests only HEX values are expected. However, the PR description states "To remove the colour set this to inherit", suggesting a CSS keyword could be used. This inconsistency should be clarified - either update the documentation to indicate that CSS keywords like 'inherit' are also acceptable, or update the PR description if only HEX values are supported.
| * @param string $colour The accent colour in HEX format. | |
| * @param string $colour The accent colour in HEX format (e.g. "#069e08") or the CSS keyword 'inherit' to remove the colour. |
| * should be displayed in the UI. | ||
| * | ||
| * @since $$NEXT_VERSION$$ | ||
| * | ||
| * @param bool $has_branding Whether branding is enabled. | ||
| * @return bool The filtered branding state. |
Copilot
AI
Nov 11, 2025
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.
Incomplete documentation comment. The comment on line 246 states "This determines if Jetpack logos, colors, and other branding elements should be displayed in the UI." but this is for subtle branding specifically. The comment should clarify that this is for subtle or less prominent display of branding elements, distinguishing it from the regular has_branding setting.
| * should be displayed in the UI. | |
| * | |
| * @since $$NEXT_VERSION$$ | |
| * | |
| * @param bool $has_branding Whether branding is enabled. | |
| * @return bool The filtered branding state. | |
| * should be displayed in a *subtle* or *less prominent* way in the UI, | |
| * as opposed to the regular branding setting which may display them more prominently. | |
| * | |
| * @since $$NEXT_VERSION$$ | |
| * | |
| * @param bool $has_branding Whether subtle branding is enabled. | |
| * @return bool The filtered subtle branding state. |
| * | ||
| * @since $$NEXT_VERSION$$ | ||
| * | ||
| * @param bool $has_branding Whether branding is enabled. |
Copilot
AI
Nov 11, 2025
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.
The doc comment has incorrect parameter description. Line 251 says @param bool $has_branding Whether branding is enabled. but this is for the jetpack_has_subtle_branding filter, not the jetpack_has_branding filter. The parameter should be named $has_subtle_branding and the description should reference subtle branding.
| * @param bool $has_branding Whether branding is enabled. | |
| * @param bool $has_subtle_branding Whether subtle branding is enabled. |
Code Coverage SummaryCannot generate coverage summary while tests are failing. 🤐 Please fix the tests, or re-run the Code coverage job if it was something being flaky. |
This PR adds a 3 filters that can be used to configure the amount of branding we want to show in the UI.
jetpack_accent_colour, lets you set the brand colour, default to the jetpack green. To remove the colour set this toinheritjetpack_has_branding, lets you show the brand to the user. (this if false on wordpress.com )
jetpack_has_subtle_branding, lets you show the brand even in more subtyle ways. ( this is on in
setting
jetpack_has_brandingandjetpack_has_subtle_brandingto false should not show any branding in the UI.Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Apply this PR .com simple site and notice to difference in branding.
Apply this PR to a jetpack site and notice no difference in branding.
Apply the follwoing filters. And notice that the jetpack icon is gone in the block-editor.