Automattic\WooCommerce\Blocks\BlockTypes
CustomerAccount::render_link
Render the block as a simple link (default behavior).
Метод класса: CustomerAccount{}
Хуков нет.
Возвращает
string. Rendered block output.
Использование
// private - только в коде основоного (родительского) класса $result = $this->render_link( $attributes, $classes_and_styles, $account_link, $aria_label, $label_markup );
- $attributes(массив) (обязательный)
- Block attributes.
- $classes_and_styles(массив) (обязательный)
- Classes and styles from block attributes.
- $account_link(строка) (обязательный)
- URL to link to.
- $aria_label(строка) (обязательный)
- Pre-computed aria-label attribute string.
- $label_markup(строка) (обязательный)
- Pre-computed label HTML markup.
Код CustomerAccount::render_link() CustomerAccount::render link WC 11.3.0
<?php
private function render_link( $attributes, $classes_and_styles, $account_link, $aria_label, $label_markup ) {
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 $this->render_visual( $attributes ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo $label_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</a>
</div>
<?php
return (string) ob_get_clean();
}