Skip to content

Commit

Permalink
[#105] Dummy proof the icon filter
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget committed Jun 13, 2024
1 parent 7c15195 commit a3e8eb6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a3e8eb6

Please sign in to comment.