protected function normalizePanelConfiguration()
{
$panels = [];
foreach ($this->panels as $key => $value) {
if (is_numeric($key)) {
// The $value contains the identifier of a core panel
if (!isset($this->_corePanels[$value])) {
throw new InvalidConfigException("'{$value}' is not a valid panel identifier");
}
$panels[$value] = $this->_corePanels[$value];
} else {
// The key contains the identifier and the value is either a class name or a full array
$panels[$key] = is_string($value) ? ['class' => $value] : $value;
}
}
$this->panels = ArrayHelper::merge($panels, $this->panelsMerge);
// We now need one more iteration to add core classes to the panels added via the merge, if needed
array_walk($this->panels, function (&$value, $key) {
if (!isset($value['class'])) {
if (isset($this->_corePanels[$key])) {
$value = ArrayHelper::merge($value, $this->_corePanels[$key]);
} else {
throw new InvalidConfigException("Invalid configuration for '{$key}'. No 'class' specified.");
}
}
});
}