<?php
$align = isset($attributes['align']) ? $attributes['align'] : '';
$link = isset($attributes['link']) ? $attributes['link'] : [];
$text = isset($attributes['text']) ? $attributes['text'] : '';
$color = isset($attributes['color']) ? $attributes['color'] : '';




$styles = [];
if ($color) {
	$styles[] = 'color: ' . esc_attr($color);
	$styles[] = '--cta-current-color: ' . esc_attr($color);
}

$wrapper_attributes = get_block_wrapper_attributes([
	'class' => 'align--' . esc_attr($align),
	'style' => implode('; ', $styles)
]);

$link_url = isset($link['url']) ? esc_url($link['url']) : '#';
?>

<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?>>
	<?php echo esc_html($text); ?>
</a>