Skip to content

Commit 9f4459c

Browse files
authored
Merge pull request #2359 from MartijnvAdrichem/bugfix-label-with-name-arrays
Fix a bug that caused backpack to crash when a field with an array of names and no label was defined
2 parents bb9c8f6 + 8848fd2 commit 9f4459c

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
@@ -43,7 +43,8 @@ public function addField($field)
4343

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

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

0 commit comments

Comments
 (0)