carhop__plugins__PROD-DEV/plugins/carhop-blocks/build/cta/render.php
Antoine M 5dc6ea260d
All checks were successful
continuous-integration/drone/push Build is passing
CHORE REFACTOR upgrading plugin to handle a unique monopackage bundler
2025-11-20 11:06:56 +01:00

26 lines
733 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'] : '';
$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>