Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions
VariationDescription::render
Render the block.
Method of the class: VariationDescription{}
No Hooks.
Returns
String. Rendered block output.
Usage
// protected - for code of main (parent) or child class $result = $this->render( $attributes, $content, $block );
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
VariationDescription::render() VariationDescription::render code WC 10.9.1
protected function render( $attributes, $content, $block ) {
global $product;
if ( ! $product instanceof \WC_Product_Variable ) {
return '';
}
$context_directive = wp_interactivity_data_wp_context(
array(
'productElementKey' => 'description',
)
);
$wrapper_attributes = array(
'data-wp-interactive' => 'woocommerce/product-elements',
'data-wp-bind--hidden' => 'woocommerce/products::!state.productVariationInContext.description',
'aria-live' => 'polite',
'aria-atomic' => 'true',
);
return '<div ' . $context_directive . ' ' . get_block_wrapper_attributes( $wrapper_attributes ) . ' data-wp-watch="callbacks.updateValue"></div>';
}