Skip to content

Commit

Permalink
FIX Always add dataClass to models spec
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 26, 2022
1 parent 7c160b6 commit f31535a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/ModelAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,14 @@ public function getManagedModels()

// Normalize models to have their model class in array key
foreach ($models as $k => $v) {
// No custom tab url segment
if (is_numeric($k)) {
$models[$v] = ['dataClass' => $v, 'title' => singleton($v)->i18n_plural_name()];
unset($models[$k]);
// Custom tab url segment but no custom title
} elseif (is_a($v, DataObject::class, true)) {
$models[$k] = ['dataClass' => $v, 'title' => singleton($v)->i18n_plural_name()];
// Custom title but no custom tab url segment
} elseif (is_array($v) && !isset($v['dataClass'])) {
$models[$k]['dataClass'] = $k;
}
Expand Down

0 comments on commit f31535a

Please sign in to comment.