[Product Block Editor]: Add `Linked product` tab (#43009)
* add linked-products to group IDs * add Linked Products tab * tweak hideConditions condition * changelog * fix typo in doc comment
This commit is contained in:
parent
65828db266
commit
eac1a460f0
|
@ -1,4 +1,4 @@
|
|||
Significance: patch
|
||||
Type: add
|
||||
|
||||
add `product-linked` feature flag
|
||||
[Product Block Editor]: add `Linked products` tab
|
||||
|
|
|
@ -16,12 +16,13 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
|
|||
* The context name used to identify the editor.
|
||||
*/
|
||||
const GROUP_IDS = array(
|
||||
'GENERAL' => 'general',
|
||||
'ORGANIZATION' => 'organization',
|
||||
'PRICING' => 'pricing',
|
||||
'INVENTORY' => 'inventory',
|
||||
'SHIPPING' => 'shipping',
|
||||
'VARIATIONS' => 'variations',
|
||||
'GENERAL' => 'general',
|
||||
'ORGANIZATION' => 'organization',
|
||||
'PRICING' => 'pricing',
|
||||
'INVENTORY' => 'inventory',
|
||||
'SHIPPING' => 'shipping',
|
||||
'VARIATIONS' => 'variations',
|
||||
'LINKED_PRODUCTS' => 'linked-products',
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -149,6 +150,24 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Linked Products tab.
|
||||
if ( Features::is_enabled( 'product-linked' ) ) {
|
||||
$this->add_group(
|
||||
array(
|
||||
'id' => $this::GROUP_IDS['LINKED_PRODUCTS'],
|
||||
'order' => 60,
|
||||
'attributes' => array(
|
||||
'title' => __( 'Linked products', 'woocommerce' ),
|
||||
),
|
||||
'hideConditions' => Features::is_enabled( 'product-linked' ) ? array(
|
||||
array(
|
||||
'expression' => 'editedProduct.type === "grouped"',
|
||||
),
|
||||
) : null,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue