Skip to content

Commit 62c2a8d

Browse files
kodinkatcorsacca
andauthored
#2634 - Resolved Multi-Select Language Field Bug (#2678)
* Resolved multi-select language field bug * Use default label instead of key * FIx contact languages field at source --------- Co-authored-by: corsac <corsacca@gmail.com>
1 parent d9f8daa commit 62c2a8d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

dt-core/configuration/config-site-defaults.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ function dt_get_option( string $name ) {
251251
'es' => [ 'label' => 'Spanish' ]
252252
];
253253
}
254+
$available_languages = dt_get_available_languages( true, true );
255+
foreach ( $languages as $key => $language ) {
256+
if ( empty( $language['label'] ) ) {
257+
$languages[$key]['label'] = $available_languages[$key]['label'] ?? $key;
258+
}
259+
}
254260
$languages = DT_Posts_Hooks::dt_get_field_options_translation( $languages );
255261
return apply_filters( 'dt_working_languages', $languages );
256262

dt-core/utilities/dt-components.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function render_multi_select( $field_key, $fields, $post, $params
173173
$options_array = array_map(function ( $key, $value ) {
174174
return [
175175
'id' => $key,
176-
'label' => $value['label'],
176+
'label' => $value['label'] ?? $key,
177177
'color' => $value['color'] ?? null,
178178
'icon' => $value['icon'] ?? null,
179179
];

0 commit comments

Comments
 (0)