Commit d1bb7fda authored by Tino Goratsch's avatar Tino Goratsch

Fixed the bug that it was not possible to create new articles when the menu...

Fixed the bug that it was not possible to create new articles when the menu items module was installed and active, but there were no menus at all
parent 2b2805fc
......@@ -58,7 +58,8 @@ abstract class AbstractFormAction extends AbstractFrontendAction
*/
protected function createOrUpdateMenuItem(array $formData, $articleId)
{
if ($this->acl->hasPermission('admin/menus/items/create') === true) {
if ($this->acl->hasPermission('admin/menus/items/create') === true
&& $this->hasNecessaryMenuItemFormFields()) {
$data = [
'mode' => 4,
'block_id' => $formData['block_id'],
......@@ -75,4 +76,12 @@ abstract class AbstractFormAction extends AbstractFrontendAction
);
}
}
/**
* @return bool
*/
private function hasNecessaryMenuItemFormFields()
{
return isset($formData['block_id'], $formData['parent_id'], $formData['display'], $formData['menu_item_title']);
}
}
......@@ -74,17 +74,20 @@ class OnMenusLayoutRenderManageMenuItemListener
$parameters = $event->getParameters();
if ($this->acl->hasPermission('admin/menus/items/create') === true) {
$menuItem = $this->fetchMenuItems(!empty($parameters['path']) ? $parameters['path'] : '');
$this->view
->assign(
'options',
$this->fetchCreateMenuItemOption(!empty($menuItem) ? 1 : 0)
)
->assign('form', $this->modifyFormValues($menuItem))
->assign($this->addFormFields($menuItem));
$this->view->displayTemplate('Menus/Partials/manage_menu_item.tpl');
$menuItem = $this->fetchMenuItem(!empty($parameters['path']) ? $parameters['path'] : '');
$formFields = $this->addFormFields($menuItem);
if (!empty($formFields['blocks'])) {
$this->view
->assign(
'options',
$this->fetchCreateMenuItemOption(!empty($menuItem) ? 1 : 0)
)
->assign('form', $this->modifyFormValues($menuItem))
->assign($formFields);
$this->view->displayTemplate('Menus/Partials/manage_menu_item.tpl');
}
}
}
......@@ -92,7 +95,7 @@ class OnMenusLayoutRenderManageMenuItemListener
* @param string $routeName
* @return array
*/
private function fetchMenuItems($routeName)
private function fetchMenuItem($routeName)
{
$menuItem = $this->menuItemRepository->getOneMenuItemByUri($routeName);
......
......@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Added the new data grid column renderer `RouteColumnRenderer` which makes it possible specify and open routes in new tabs
### Fixed
- Fixed the bug that it was not possible to create new articles when the menu items module was installed and active, but there were no menus at all
## [4.16.0] - 2017-10-24
### Added
- Added a new option which completely disables the site subtitle program logic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment