From a3e8eb6f9a342d23d10bab5d6269feb2a5a52082 Mon Sep 17 00:00:00 2001 From: Brian DiChiara Date: Thu, 13 Jun 2024 13:38:00 -0500 Subject: [PATCH] [#105] Dummy proof the icon filter --- .../plugins/acf-blocks-toolkit/includes/button-icons.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-content/plugins/acf-blocks-toolkit/includes/button-icons.php b/wp-content/plugins/acf-blocks-toolkit/includes/button-icons.php index 794df61d..5fe94d6a 100644 --- a/wp-content/plugins/acf-blocks-toolkit/includes/button-icons.php +++ b/wp-content/plugins/acf-blocks-toolkit/includes/button-icons.php @@ -299,8 +299,14 @@ function acfbt_generate_json(): void { $json = []; foreach ( $icons as $slug => $icon ) { + if ( ! is_array( $icon ) ) { + $icon = [ 'icon' => $icon ]; + } + + $default_label = is_numeric( $slug ) ? __( 'Icon', 'acf-blocks-toolkit' ) . ' ' . $slug : ucwords( str_replace( '-', ' ', $slug ) ); + $json[] = [ - 'label' => $icon['label'], + 'label' => $icon['label'] ?? $default_label, 'value' => $slug, 'icon' => $icon['icon'], 'defaultLeft' => $icon['defaultLeft'] ?? false,