Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
label={ __( 'Product rating', 'woo-gutenberg-products-block' ) }
checked={ attributes.showReviewRating }
onChange={ () =>
setAttributes( {
showReviewRating: ! attributes.showReviewRating,
} )
}
/>
{ attributes.showReviewRating && ! REVIEW_RATINGS_ENABLED && (
{ sprintf(
escapeHTML(
/* translators: A notice that links to WooCommerce settings. */
__(
'Product rating is disabled in your %sstore settings%s.',
'woo-gutenberg-products-block'
)
),
`<a href="${ getAdminLink(
'admin.php?page=wc-settings&tab=products'
) }">`,
'</a>'
) }
) }
export function renderElement( element, context, legacyContext = {} ) {
if ( null === element || undefined === element || false === element ) {
return '';
}
if ( Array.isArray( element ) ) {
return renderChildren( element, context, legacyContext );
}
switch ( typeof element ) {
case 'string':
return escapeHTML( element );
case 'number':
return element.toString();
}
const { type, props } = element;
switch ( type ) {
case StrictMode:
case Fragment:
return renderChildren( props.children, context, legacyContext );
case RawHTML:
const { children, ...wrapperProps } = props;
return renderNativeComponent(
function announceCurrentSlide( swiper ) {
const currentSlide = swiper.slides[ swiper.activeIndex ];
if ( ! currentSlide ) {
return;
}
const figcaption = currentSlide.getElementsByTagName( 'FIGCAPTION' )[ 0 ];
const img = currentSlide.getElementsByTagName( 'IMG' )[ 0 ];
if ( swiper.a11y.liveRegion ) {
swiper.a11y.liveRegion[ 0 ].innerHTML = figcaption
? figcaption.innerHTML
: escapeHTML( img.alt );
}
}
return children.map( ( child ) => {
return child.text === undefined ? createElementHTML( child ) : escapeHTML( child.text );
} ).join( '' );
}