NavigationConfigForm: Do not allow to choose a parent once a item is shared

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-18 10:52:03 +02:00
parent 4b7fbdfa1f
commit 9477c53b43
2 changed files with 9 additions and 4 deletions

View File

@ -16,8 +16,11 @@ class MenuItemForm extends NavigationItemForm
public function createElements(array $formData)
{
parent::createElements($formData);
$this->getParent()->getElement('parent')->setDescription($this->translate(
$parentElement = $this->getParent()->getElement('parent');
if ($parentElement !== null) {
$parentElement->setDescription($this->translate(
'The parent menu to assign this menu entry to. Select "None" to make this a main menu entry'
));
}
}
}

View File

@ -431,6 +431,7 @@ class NavigationConfigForm extends ConfigForm
*/
public function createElements(array $formData)
{
$shared = false;
$itemTypes = $this->getItemTypes();
$itemType = isset($formData['type']) ? $formData['type'] : key($itemTypes);
$itemForm = $this->getItemForm($itemType);
@ -466,6 +467,7 @@ class NavigationConfigForm extends ConfigForm
);
if ($checked || (isset($formData['shared']) && $formData['shared'])) {
$shared = true;
$this->addElement(
'text',
'users',
@ -501,7 +503,7 @@ class NavigationConfigForm extends ConfigForm
)
);
if ($itemForm->requiresParentSelection()) {
if (! $shared && $itemForm->requiresParentSelection()) {
$availableParents = $this->listAvailableParents($itemType);
$this->addElement(
'select',