Skip to content

Commit 8848fd2

Browse files
author
Martijn
committed
Fix a bug that caused backpack to crash when a field with an array of names and no label was defined
1 parent 941b4a4 commit 8848fd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/app/Library/CrudPanel/Traits/Fields.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function addField($field)
4444

4545
// if the label is missing, we should set it
4646
if (! isset($newField['label'])) {
47-
$newField['label'] = mb_ucfirst(str_replace('_', ' ', $newField['name']));
47+
$label = is_array($newField['name']) ? $newField['name'][0] : $newField['name'];
48+
$newField['label'] = mb_ucfirst(str_replace('_', ' ', $label));
4849
}
4950

5051
// if the field type is missing, we should set it

0 commit comments

Comments
 (0)