Hide Downloads section under Toggle (#43864)

* Add Include downloads to show/hide the Downloads section

* Fix margin top for none first child nested sections

* Add changelog files

* Fix php linter errors
This commit is contained in:
Maikel Perez 2024-01-23 12:12:52 -03:00 committed by GitHub
parent dbae7d6661
commit 26a546954a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 49 additions and 6 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Fix margin top for none first child nested sections

View File

@ -53,7 +53,9 @@
}
.wp-block-woocommerce-product-section {
margin-top: 0;
&:first-child {
margin-top: 0;
}
padding-bottom: 0;
border-bottom: none;
}
@ -74,9 +76,15 @@
* Core removes the "loading" animation styles
* from the button when it's disabled, so we
* let's add them back.
*/
*/
.components-button.is-tertiary.is-busy:disabled {
background-image: linear-gradient( -45deg, #fafafa 33%, #e0e0e0 0, #e0e0e0 70%, #fafafa 0 );
background-image: linear-gradient(
-45deg,
#fafafa 33%,
#e0e0e0 0,
#e0e0e0 70%,
#fafafa 0
);
background-size: 100px 100%;
opacity: 1;
}

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add Include downloads to show/hide the Downloads section

View File

@ -455,10 +455,37 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
);
// Downloads section.
if ( Features::is_enabled( 'product-virtual-downloadable' ) ) {
$general_group->add_section(
$product_downloads_section_group = $general_group->add_section(
array(
'id' => 'product-downloads-section-group',
'order' => 50,
'attributes' => array(
'blockGap' => 'unit-40',
),
'hideConditions' => array(
array(
'expression' => 'editedProduct.type !== "simple"',
),
),
)
);
$product_downloads_section_group->add_block(
array(
'id' => 'product-downloadable',
'blockName' => 'woocommerce/product-checkbox-field',
'order' => 10,
'attributes' => array(
'property' => 'downloadable',
'label' => __( 'Include downloads', 'woocommerce' ),
),
)
);
$product_downloads_section_group->add_section(
array(
'id' => 'product-downloads-section',
'order' => 50,
'order' => 20,
'attributes' => array(
'title' => __( 'Downloads', 'woocommerce' ),
'description' => sprintf(
@ -470,7 +497,7 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
),
'hideConditions' => array(
array(
'expression' => 'editedProduct.type !== "simple"',
'expression' => 'editedProduct.downloadable !== true',
),
),
)