NavigationConfigForm: Properly handle parent names consisting only of numbers

This commit is contained in:
Johannes Meyer 2019-06-26 11:40:30 +02:00
parent 245f392a9d
commit 5c5ca26596
1 changed files with 4 additions and 6 deletions

View File

@ -213,7 +213,7 @@ class NavigationConfigForm extends ConfigForm
$names = array();
foreach ($this->getShareConfig($type) as $sectionName => $sectionConfig) {
if ($sectionName !== $this->itemToLoad
if ((string) $sectionName !== $this->itemToLoad
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
&& ! in_array($sectionName, $children, true)
) {
@ -222,7 +222,7 @@ class NavigationConfigForm extends ConfigForm
}
foreach ($this->getUserConfig($type) as $sectionName => $sectionConfig) {
if ($sectionName !== $this->itemToLoad
if ((string) $sectionName !== $this->itemToLoad
&& ! in_array($sectionName, $children, true)
) {
$names[] = $sectionName;
@ -662,10 +662,8 @@ class NavigationConfigForm extends ConfigForm
'The parent item to assign this navigation item to. '
. 'Select "None" to make this a main navigation item'
),
'multiOptions' => array_merge(
array('' => $this->translate('None', 'No parent for a navigation item')),
empty($availableParents) ? array() : array_combine($availableParents, $availableParents)
)
'multiOptions' => ['' => $this->translate('None', 'No parent for a navigation item')]
+ (empty($availableParents) ? [] : array_combine($availableParents, $availableParents))
)
);
}