Automattic\WooCommerce\Blocks\BlockTypes
CartLink::render
Render the block.
Method of the class: CartLink{}
No Hooks.
Returns
String
. | void 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.
CartLink::render() CartLink::render code WC 9.9.4
protected function render( $attributes, $content, $block ) { $classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $icon = MiniCartUtils::get_svg_icon( $attributes['cartIcon'] ?? '' ); $text = array_key_exists( 'content', $attributes ) ? esc_html( $attributes['content'] ) : esc_html__( 'Cart', 'woocommerce' ); return sprintf( '<div %1$s><a class="wc-block-cart-link" href="%2$s">%3$s<span class="wc-block-cart-link__text">%4$s</span></a></div>', get_block_wrapper_attributes( array( 'class' => esc_attr( $classes_and_styles['classes'] ), 'style' => $classes_and_styles['styles'], ) ), esc_url( wc_get_cart_url() ), $icon, $text ); }