Improve error handling for invalid counter properties on backend menu items
This commit is contained in:
parent
1b8fae0ef0
commit
ef36399cf7
|
|
@ -373,7 +373,7 @@ class NavigationManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($item->counter)) {
|
if (empty($item->counter) || !is_numeric($item->counter)) {
|
||||||
$item->counter = null;
|
$item->counter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -421,6 +421,9 @@ class NavigationManager
|
||||||
$item->counter = null;
|
$item->counter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!is_null($item->counter) && !is_numeric($item->counter)) {
|
||||||
|
throw new SystemException("The menu item {$activeItem->code}.{$item->code}'s counter property is invalid. Check to make sure it's numeric or callable. Value: " . var_export($item->counter, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue