Skip to content
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

Consolidate overall Global Styles mechanics in the server #20047

Merged
merged 40 commits into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f52ca32
Warm up changes
oandregal Feb 4, 2020
846e8e6
Use same pattern name
oandregal Feb 4, 2020
c41405b
Extract get_from_file function
oandregal Feb 4, 2020
f49f113
Add placeholder to retrieve user global styles
oandregal Feb 4, 2020
f598d4a
Simplify css vars retrieval
oandregal Feb 4, 2020
ce83c98
Better docs
oandregal Feb 4, 2020
f54be58
Better docs
oandregal Feb 4, 2020
187dd64
Extract resolver
oandregal Feb 4, 2020
021f68b
Simplify global styles tree processing
oandregal Feb 4, 2020
9f43b0a
Fix concatenation
oandregal Feb 4, 2020
7016861
Simplify to global css custom prop
oandregal Feb 4, 2020
112ad14
Register CPT to store user global styles
oandregal Feb 4, 2020
9ebb0e6
Add data for client within block-editor settings
oandregal Feb 4, 2020
a853cbf
Take into account theme support
oandregal Feb 4, 2020
43437ae
Pass core&theme global styles to client
oandregal Feb 4, 2020
6001d87
Use gutenberg_experimental_global_styles_ as function prefix
oandregal Feb 4, 2020
357951c
Retrieve user data from CPT
oandregal Feb 4, 2020
1bdf097
Make user data to be an array
oandregal Feb 4, 2020
c2eeac1
Filter by post date and slug/name
oandregal Feb 4, 2020
9197535
Cool down refactorings
oandregal Feb 4, 2020
23a9d31
Create wp_global_styles draft in editor if there is no CPT
oandregal Feb 4, 2020
455cc17
Centralize theme support check
oandregal Feb 4, 2020
c89779c
Better docs
oandregal Feb 4, 2020
2d0fa0e
Consolidate block settings names
oandregal Feb 4, 2020
ac12333
We should check theme support at later stages
oandregal Feb 4, 2020
d4fed71
Fix typo
oandregal Feb 5, 2020
3e40c29
Follow post name convention: use dash instead of underscore
oandregal Feb 5, 2020
caf9773
Make linter happy
oandregal Feb 5, 2020
946c398
Only load Global Styles if experiment is enabled
oandregal Feb 5, 2020
1a6db21
Add Global Styles setting to experiments page
oandregal Feb 5, 2020
3aaccc1
Use FSE experiment flag instead of dedicated Global Styles one
oandregal Feb 6, 2020
527c263
Update token
oandregal Feb 11, 2020
ef09131
Adapt CSS custom properties to new convention
oandregal Feb 11, 2020
1588f8c
Use theme textdomain
oandregal Feb 11, 2020
1d9169e
Check for array key presence
oandregal Feb 11, 2020
aeddf60
Detect whether we are in the site editor context.
oandregal Feb 11, 2020
1e45e2d
Fire block settings hook in edit-site
oandregal Feb 11, 2020
9fe7800
Enqueue assets in a way that works for edit-site
oandregal Feb 11, 2020
ee550ad
Add some editor checks: only load if edit-site
oandregal Feb 11, 2020
6f1e87b
Remove unrelated changes
oandregal Feb 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions experimental-default-global-styles.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"global": {
"color": {
"primary": "#52accc",
"background": "white",
"text": "black"
}
"color": {
"primary": "#52accc",
"background": "white",
"text": "black"
}
}
5 changes: 5 additions & 0 deletions lib/edit-site-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ function gutenberg_edit_site_init( $hook ) {
apply_filters( 'template_include', null );
$settings['templateId'] = $_wp_current_template_id;

// This is so other parts of the code can hook their own settings.
// Example: Global Styles.
global $post;
$settings = apply_filters( 'block_editor_settings', $settings, $post );

// Initialize editor.
wp_add_inline_script(
'wp-edit-site',
Expand Down
Loading