feature: Add field for ARIA label in button block

This commit is contained in:
Keith Solomon
2025-11-25 08:50:39 -06:00
parent f086c17d26
commit a1d2b59919
3 changed files with 133 additions and 70 deletions

View File

@@ -10,9 +10,10 @@ namespace BasicWP;
// Retrieve ACF fields
$element = get_field( 'element' ) ? get_field( 'element' ) : 'a';
$btnLink = get_field( 'link' );
$url = $btnLink['url'] ? $btnLink['url'] : '';
$target = $btnLink['target'] ? $btnLink['target'] : '';
$btnTitle = $btnLink['title'] ? $btnLink['title'] : 'Button';
$url = isset( $btnLink['url'] ) ? $btnLink['url'] : '';
$target = isset( $btnLink['target'] ) ? $btnLink['target'] : '';
$btnTitle = isset( $btnLink['title'] ) ? $btnLink['title'] : 'Button';
$btnAria = get_field( 'aria_label' ) ? get_field( 'aria_label' ) : '';
$color = get_field( 'color' );
$variant = get_field( 'variant' );
$size = get_field( 'size' );
@@ -44,6 +45,7 @@ if ( ! $is_preview ) {
url="<?php echo esc_url( $url ); ?>"
target="<?php echo esc_attr( $target ); ?>"
title="<?php echo esc_attr( $btnTitle ); ?>"
ariaLabel="<?php echo esc_attr( $btnAria ); ?>"
color="<?php echo esc_attr( $color ); ?>"
variant="<?php echo esc_attr( $variant ); ?>"
size="<?php echo esc_attr( $size ); ?>"