mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Copy changes for theme export back to core #2534
Closed
Closed
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bff007b
Copy changes for theme export back to core
scruffian efc71c4
Add since to the patterns function
scruffian 890af0e
add unit test
scruffian 7fda13e
Add tests for theme json
scruffian 70df60d
Add changes to the resolver too
scruffian fabe054
remove gutenberg namespacing
scruffian 8858303
add a missing .0
scruffian 6765324
fix tabs
scruffian 664b8a2
fix indenting
scruffian 0dfc4eb
update unit test
scruffian 4a3421f
update the tests for the theme export
scruffian 701dac3
fix linter
scruffian 648bd90
update test
scruffian 800e223
add deprecated notice to should_override_preset
scruffian aba26af
Add docs from patch file
scruffian 2868c57
Update src/wp-includes/class-wp-theme-json.php
scruffian e26561e
Update src/wp-includes/class-wp-theme-json.php
scruffian 94cd72c
Add more source control systems to the excluded array
scruffian 7fcb6de
Merge branch 'update/theme-export-for-6.0' of github.com:scruffian/wo…
scruffian 9722e91
align descriptions
scruffian ca12de4
increase the line length in the docblock
scruffian 15526a2
specify the function to use instead of should_override_preset
scruffian 2529def
rename param and use wp_parse_args
scruffian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,14 +151,17 @@ public static function get_core_data() { | |
* | ||
* @since 5.8.0 | ||
* @since 5.9.0 Theme supports have been inlined and the `$theme_support_data` argument removed. | ||
* @since 6.0.0 Adds a second parameter to allow the theme data to be returned without theme supports. | ||
* | ||
* @param array $deprecated Deprecated. Not used. | ||
* @param array $settings Contains a key called with_supports to determine whether to include theme supports in the data. | ||
* @return WP_Theme_JSON Entity that holds theme data. | ||
*/ | ||
public static function get_theme_data( $deprecated = array() ) { | ||
public static function get_theme_data( $deprecated = array(), $settings = array( 'with_supports' => true ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't typically follow this pattern in Core. Traditionally this would be an empty array and use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 2529def |
||
if ( ! empty( $deprecated ) ) { | ||
_deprecated_argument( __METHOD__, '5.9.0' ); | ||
} | ||
|
||
if ( null === static::$theme ) { | ||
$theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); | ||
$theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); | ||
|
@@ -177,6 +180,10 @@ public static function get_theme_data( $deprecated = array() ) { | |
} | ||
} | ||
|
||
if ( ! $settings['with_supports'] ) { | ||
return static::$theme; | ||
} | ||
|
||
/* | ||
* We want the presets and settings declared in theme.json | ||
* to override the ones declared via theme supports. | ||
|
@@ -208,6 +215,9 @@ public static function get_theme_data( $deprecated = array() ) { | |
$default_gradients = true; | ||
} | ||
$theme_support_data['settings']['color']['defaultGradients'] = $default_gradients; | ||
|
||
// Classic themes without a theme.json don't support global duotone. | ||
$theme_support_data['settings']['color']['defaultDuotone'] = false; | ||
} | ||
$with_theme_supports = new WP_Theme_JSON( $theme_support_data ); | ||
$with_theme_supports->merge( static::$theme ); | ||
|
@@ -477,4 +487,5 @@ public static function get_style_variations() { | |
} | ||
return $variations; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we want to look for other VCS'? We check for
array( '.svn', '.git', '.hg', '.bzr' )
inWP_Automatic_Updater
.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.
If we're now including the whole theme in the export, excluding
vendor
may be incorrect. It isn't always/only for development dependencies. So excluding it here would preclude using runtime composer dependencies.This is something the WP Theme Review Team is doing, though maybe this would never happen for FSE themes.
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.
Done
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.
This is my hunch but I'm happy to remove it. The main motivation here is that TT2 has a vendor folder which is very large (30MB) so if people are using that as a base theme (which seems fairly likely), they will end up copying that every time. Happy to remove it though if you prefer.
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.
Yeah I definitely think we don't want to be zipping up 30MB here. I think your intuition is probably the best way to go. Maybe make the ignore directories list filterable?