-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Move default template types and template part areas to REST API #66459
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b795e9c
move default template types and template part areas to REST API
gigitux 61b90b5
fix logic
gigitux 6aaf160
fix E2E test
gigitux d141278
move default template types and template part areas to REST API
gigitux bde1d80
fix error
gigitux de703b5
remove not necessary file
gigitux f8962ce
fix naming
gigitux fc95c3f
remove duplicate code
gigitux d20b8ad
remove duplicated code
gigitux d361487
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/rest-…
gigitux afe5365
improve logic
gigitux ac06843
fix naming
gigitux 69c3d6d
fix unit test
gigitux a5647de
update doc
gigitux 2a04ba1
add unit test for getTemplateInfo function
gigitux 6723634
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/rest-…
gigitux 7241bad
restore not necessary changes
gigitux 8f47873
fix e2e test
gigitux 6acc708
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/rest-…
gigitux 7aab231
remove not necessary variable
gigitux ffdcc1d
replace add_action with add_filter
gigitux e395bf6
improve readibility code
gigitux 1f47713
make getTemplateInfo private
gigitux 078d2f6
make templateAreas optional
gigitux fdc291d
add default_template_part_areas and default_template_types
gigitux b2c0bf5
move code to rest-api.php file
gigitux 8f8649b
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/rest-…
gigitux 230ba72
remove not used import
gigitux 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
fix naming
- Loading branch information
commit ac06843cd8909a0932f1e30aeadb7533d0a377b3
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -1709,11 +1709,11 @@ export const __experimentalGetDefaultTemplateTypes = createRegistrySelector( | |
| { | ||
| since: '6.7', | ||
| alternative: | ||
| "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.defaultTemplateTypes", | ||
| "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_types", | ||
| } | ||
| ); | ||
| return select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) | ||
| ?.defaultTemplateTypes; | ||
| ?.default_template_types; | ||
| } | ||
| ); | ||
|
|
||
|
|
@@ -1732,13 +1732,13 @@ export const __experimentalGetDefaultTemplatePartAreas = createRegistrySelector( | |
| { | ||
| since: '6.7', | ||
| alternative: | ||
| "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.defaultTemplatePartAreas", | ||
| "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_part_areas", | ||
|
Contributor
Author
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. Technically, missing the last piece of the logic: areas.map( ( item ) => {
return { ...item, icon: getTemplatePartIcon( item.icon ) };
} );Not sure if I should add this line under the alternative key or simply remove it altogether. |
||
| } | ||
| ); | ||
|
|
||
| const areas = | ||
| select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) | ||
| ?.defaultTemplatePartAreas || []; | ||
| ?.default_template_part_areas || []; | ||
|
|
||
| return areas.map( ( item ) => { | ||
| return { ...item, icon: getTemplatePartIcon( item.icon ) }; | ||
|
|
@@ -1766,7 +1766,7 @@ export const __experimentalGetDefaultTemplateType = createRegistrySelector( | |
| const templateTypes = select( coreStore ).getEntityRecord( | ||
| 'root', | ||
| '__unstableBase' | ||
| )?.defaultTemplateTypes; | ||
| )?.default_template_types; | ||
|
|
||
| if ( ! templateTypes ) { | ||
| return EMPTY_OBJECT; | ||
|
|
@@ -1801,11 +1801,11 @@ export const __experimentalGetTemplateInfo = createRegistrySelector( | |
|
|
||
| const templateTypes = | ||
| select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) | ||
| ?.defaultTemplateTypes || []; | ||
| ?.default_template_types || []; | ||
|
|
||
| const templateAreas = | ||
| select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) | ||
| ?.defaultTemplatePartAreas || []; | ||
| ?.default_template_part_areas || []; | ||
|
|
||
| return getTemplateInfo( { | ||
| template, | ||
|
|
||
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.
shouldn't this be 6.8? (same below)
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.
Nice catch! I'm going to open a follow-up PR! Thanks 🙇