Automattic\WooCommerce\Blocks\BlockTypes

CustomerAccount::render()protectedWC 1.0

Render the block.

Метод класса: CustomerAccount{}

Хуков нет.

Возвращает

Строку. Rendered block output.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render( $attributes, $content, $block );
$attributes(массив) (обязательный)
Block attributes.
$content(строка) (обязательный)
Block content.
$block(WP_Block) (обязательный)
Block instance.

Код CustomerAccount::render() WC 8.7.0

protected function render( $attributes, $content, $block ) {
	$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );

	$account_link = get_option( 'woocommerce_myaccount_page_id' ) ? wc_get_account_endpoint_url( 'dashboard' ) : wp_login_url();

	$allowed_svg = array(
		'svg'  => array(
			'class'   => true,
			'xmlns'   => true,
			'width'   => true,
			'height'  => true,
			'viewbox' => true,
		),
		'path' => array(
			'd'    => true,
			'fill' => true,
		),
	);

	return "<div class='wp-block-woocommerce-customer-account " . esc_attr( $classes_and_styles['classes'] ) . "' style='" . esc_attr( $classes_and_styles['styles'] ) . "'>
		<a href='" . esc_attr( $account_link ) . "'>
			" . wp_kses( $this->render_icon( $attributes ), $allowed_svg ) . "<span class='label'>" . wp_kses( $this->render_label( $attributes ), array() ) . '</span>
		</a>
	</div>';
}