Automattic\WooCommerce\Blocks\BlockTypes
MiniCartCheckoutButtonBlock::render_experimental_iapi_markup
Render experimental iAPI block markup.
Method of the class: MiniCartCheckoutButtonBlock{}
No Hooks.
Returns
String. Rendered block type output.
Usage
// protected - for code of main (parent) or child class $result = $this->render_experimental_iapi_markup( $attributes, $content, $block );
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
MiniCartCheckoutButtonBlock::render_experimental_iapi_markup() MiniCartCheckoutButtonBlock::render experimental iapi markup code WC 10.8.1
<?php
protected function render_experimental_iapi_markup( $attributes, $content, $block ) {
$default_go_to_checkout_text = __( 'Go to checkout', 'woocommerce' );
$go_to_checkout_text = $attributes['checkoutButtonLabel'] ? $attributes['checkoutButtonLabel'] : $default_go_to_checkout_text;
$checkout_page_id = wc_get_page_id( 'checkout' );
$checkout_page_url = get_permalink( $checkout_page_id );
$wrapper_attributes = get_block_wrapper_attributes(
array(
'href' => esc_url( $checkout_page_url ),
'class' => 'wc-block-components-button wp-element-button wc-block-mini-cart__footer-checkout',
)
);
ob_start();
?>
<a <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="wc-block-components-button__text">
<?php echo esc_html( $go_to_checkout_text ); ?>
</div>
</a>
<?php
return ob_get_clean();
}