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
Hydrate product editor settings #37123
Hydrate product editor settings #37123
Conversation
Test Results SummaryCommit SHA: 612800b
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37123 +/- ##
========================================
Coverage 46.7% 46.7%
+ Complexity 17191 17190 -1
========================================
Files 429 429
Lines 64835 64832 -3
========================================
Hits 30275 30275
+ Misses 34560 34557 -3
|
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.
Nicely done! Just left a couple minor comments.
@@ -14,6 +17,13 @@ const dummyProduct = { | |||
short_description: 'Short product description content', | |||
} as Product; | |||
|
|||
declare const productBlockEditorSettings: ProductEditorSettings; |
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.
Could we simplify this naming since we don't use blocks in the other component names?
declare const productBlockEditorSettings: ProductEditorSettings; | |
declare const productEditorSettings: ProductEditorSettings; |
@@ -366,6 +366,14 @@ public static function register_post_types() { | |||
'show_in_nav_menus' => true, | |||
'show_in_rest' => true, | |||
'rest_namespace' => 'wp/v3', | |||
'template' => array( |
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 👍
$editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false; | ||
} | ||
|
||
if ( wp_is_block_theme() && $editor_settings['supportsTemplateMode'] ) { |
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.
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.
I actually decided to remove this condition, after re-reading what this logic does it seemed not overly relevant for our use case ( I think ): e8a212f
Given both conditions are to see if we have a block theme and if the theme supports block templates (neither of which we actually care about as the product screen is not theme dependant ).
f3b4f77
to
e8a212f
Compare
@joshuatf this should be good for a re-review. |
e8a212f
to
5bd8518
Compare
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.
Thanks for the changes and rebase! Testing well and code looks good.
wp_enqueue_script( $script_handle ); | ||
wp_add_inline_script( | ||
$script_handle, | ||
'var productBlockEditorSettings = productBlockEditorSettings || ' . wp_json_encode( $editor_settings ) . ';', |
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.
We discussed briefly today in our call, but we might update this to blockProductEditorSettings
and probably the same for this file name to avoid any ambiguity in naming.
We can discuss over Slack though; no reason to hold up this PR.
5bd8518
to
612800b
Compare
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.
Hey @louwie17 , this was already approved and ready to go other than a quick rebase. I went ahead and did so, retested, and I'll likely merge. Hope you don't mind!
All Submissions:
Changes proposed in this Pull Request:
Closes #37120 .
How to test the changes in this Pull Request:
new-product-management-experience
feature is enabledproductBlockEditorSettings
and make sure it is an object contain a bunch of the editor settings.*Note: I did already add an initial template, but this won't take effect until we integrate the entity store which may be done as part of this PR: #37003
Other information:
pnpm --filter=<project> changelog add
?FOR PR REVIEWER ONLY: