carhop__plugins__PROD-DEV/plugins/carhop-blocks/blocks/cta/build/cta/render.php

24 lines
672 B
PHP

<?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'] : 'red';
$wrapper_attributes = get_block_wrapper_attributes([
'class' => 'align--' . esc_attr($align),
'style' => sprintf(
'color: %s; --cta-current-color: %s;',
esc_attr($color),
esc_attr($color)
)
]);
$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>