Automattic\WooCommerce\Blocks\BlockTypes

CustomerAccount::render_linkprivateWC 1.0

Render the block as a simple link (default behavior).

Method of the class: CustomerAccount{}

No Hooks.

Returns

String. Rendered block output.

Usage

// private - for code of main (parent) class only
$result = $this->render_link( $attributes, $classes_and_styles, $account_link, $aria_label, $label_markup );
$attributes(array) (required)
Block attributes.
$classes_and_styles(array) (required)
Classes and styles from block attributes.
$account_link(string) (required)
URL to link to.
$aria_label(string) (required)
Pre-computed aria-label attribute string.
$label_markup(string) (required)
Pre-computed label HTML markup.

CustomerAccount::render_link() code WC 10.8.1

<?php
private function render_link( $attributes, $classes_and_styles, $account_link, $aria_label, $label_markup ) {
	$allowed_svg = $this->get_allowed_svg();

	ob_start();
	?>
	<div
		class="wp-block-woocommerce-customer-account <?php echo esc_attr( $classes_and_styles['classes'] ); ?>"
		style="<?php echo esc_attr( $classes_and_styles['styles'] ); ?>"
	>	
		<a
			class="wc-block-customer-account__link"
			href="<?php echo esc_url( $account_link ); ?>"
			<?php echo $aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		>
			<?php echo wp_kses( $this->render_icon( $attributes ), $allowed_svg ); ?>
			<?php echo $label_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		</a>
	</div>
	<?php
	return (string) ob_get_clean();
}