Set control label per context

This commit is contained in:
Bart Kalisz 2024-09-09 16:28:47 +02:00
parent 6e09d7b480
commit cd537befbe
3 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,7 @@ function useProducts(
}
export const HandPickedProductsControlField = ( {
label,
query,
trackInteraction,
setQueryAttribute,
@ -151,7 +152,7 @@ export const HandPickedProductsControlField = ( {
return (
<FormTokenField
displayTransform={ transformTokenIntoProductName }
label={ __( 'Select Products', 'woocommerce' ) }
label={ label || __( 'Hand-Picked Products', 'woocommerce' ) }
onChange={ onTokenChange }
onInputChange={ isLargeCatalog ? handleSearch : undefined }
suggestions={ suggestions }

View File

@ -289,6 +289,7 @@ const CollectionSpecificControls = (
'woocommerce/product-collection/hand-picked' && (
<HandPickedProductsControlField
{ ...queryControlProps }
label={ __( 'Select Products', 'woocommerce' ) }
/>
)
}

View File

@ -142,6 +142,7 @@ export type DisplayLayoutControlProps = {
setAttributes: ProductCollectionSetAttributes;
};
export type QueryControlProps = {
label?: string;
query: ProductCollectionQuery;
trackInteraction: TrackInteraction;
setQueryAttribute: ( attrs: Partial< ProductCollectionQuery > ) => void;