FEATURE: use module_settings field instaed of config().
This way should be more reliable, because config() is available only after publishing module, however I can't publish module when it does not have config (module.json). In this way I can select all modules from database and generate module.json for each of them.
This commit is contained in:
@@ -87,4 +87,11 @@ interface AppHandler
|
||||
* @param User $user model of logged user
|
||||
*/
|
||||
public static function registerAdminMenu(User $user);
|
||||
|
||||
/**
|
||||
* Install module
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function install();
|
||||
}
|
||||
+30
-30
@@ -65,16 +65,6 @@ abstract class Handler implements AppHandler
|
||||
|
||||
// create instance of main menu
|
||||
\Menu::create('mainMenu', function ($menu) {
|
||||
/**
|
||||
* @var $menu \Pingpong\Menus\MenuBuilder
|
||||
*/
|
||||
|
||||
// create menu entries
|
||||
|
||||
/*
|
||||
* WARNING: MenuBuilder::route() does not seem to work,
|
||||
* nor route() helper function. We need to use action() helper instaed.
|
||||
*/
|
||||
$menu->route('admin.dashboard', trans('admin/mainMenu.dashboard'), [], 10, ['icon' => 'fa fa-dashboard']);
|
||||
$menu->dropdown(trans('admin/mainMenu.userManagement'), function ($sub) {
|
||||
$sub->route('users.new', trans('admin/mainMenu.newUser'), [], 10, ['icon' => 'fa fa-user-plus']);
|
||||
@@ -82,26 +72,32 @@ abstract class Handler implements AppHandler
|
||||
$sub->route('users.overview', trans('admin/mainMenu.usersOverview'), [], 30, ['icon' => 'fa fa-users']);
|
||||
}, 20, ['icon' => 'fa fa-users']);
|
||||
$menu->dropdown(trans('admin/mainMenu.contentPages'), function ($sub) {
|
||||
$modules = ModuleNamesWithIds::getWithTranslations();
|
||||
|
||||
$sub->dropdown(trans('admin/mainMenu.newContentPage'), function ($sub) {
|
||||
$i = 1;
|
||||
$modules = ModuleNamesWithIds::getWithTranslations();
|
||||
foreach ($modules as $module => $name) {
|
||||
$sub->route('content.new', trans($name), ['moduleId' => $module], $i++);
|
||||
}
|
||||
}, 10, ['icon' => 'fa fa-plus']);
|
||||
if (!empty($modules)) {
|
||||
$sub->dropdown(trans('admin/mainMenu.newContentPage'), function ($sub) use ($modules) {
|
||||
$i = 1;
|
||||
foreach ($modules as $module => $name) {
|
||||
$sub->route('content.new', trans($name), ['moduleId' => $module], $i++);
|
||||
}
|
||||
}, 10, ['icon' => 'fa fa-plus']);
|
||||
}
|
||||
|
||||
$sub->route('content.overview', trans('admin/mainMenu.contentPageOverview'), [], 20, ['icon' => 'fa fa-list']);
|
||||
}, 15, ['icon' => 'fa fa-database']);
|
||||
$menu->route('upload.overview', trans('admin/mainMenu.fileManager'), [], 30, ['icon' => 'fa fa-folder']);
|
||||
$menu->dropdown(trans('admin/mainMenu.widgets'), function ($sub) {
|
||||
// create list of all widget types
|
||||
$sub->dropdown(trans('admin/mainMenu.newWidget'), function ($sub) {
|
||||
$i = 1;
|
||||
foreach (WidgetTypes::getWithTranslations() as $type => $name) {
|
||||
$sub->route('widgets.new', $name, ['type' => $type], $i++);
|
||||
}
|
||||
}, 10, ['icon' => 'fa fa-plus']);
|
||||
$widgets = WidgetTypes::getWithTranslations();
|
||||
|
||||
if (!empty($widgets)) {
|
||||
$sub->dropdown(trans('admin/mainMenu.newWidget'), function ($sub) use ($widgets) {
|
||||
$i = 1;
|
||||
foreach ($widgets as $type => $name) {
|
||||
$sub->route('widgets.new', $name, ['type' => $type], $i++);
|
||||
}
|
||||
}, 10, ['icon' => 'fa fa-plus']);
|
||||
}
|
||||
|
||||
$sub->route('widgets.overview', trans('admin/mainMenu.widgetsOverview'), [], 20, ['icon' => 'fa fa-list']);
|
||||
|
||||
@@ -111,13 +107,17 @@ abstract class Handler implements AppHandler
|
||||
$sub->route('widgetareas.overview', trans('admin/mainMenu.widgetAreaOverview'), [], 2, ['icon' => 'fa fa-list']);
|
||||
}, 50, ['icon' => 'fa fa-object-group']);
|
||||
}, 28, ['icon' => 'fa fa-gears']);
|
||||
$menu->dropdown(trans('admin/mainMenu.templates'), function ($sub) {
|
||||
$i = 1;
|
||||
$templatePaths = TemplatePathsHumanReadableRootOnly::getWithTranslations();
|
||||
foreach ($templatePaths as $id => $name) {
|
||||
$sub->route('templates.overview', $name, ['id' => $id], $i++);
|
||||
}
|
||||
}, 29, ['icon' => 'fa fa-folder-open']);
|
||||
|
||||
$templatePaths = TemplatePathsHumanReadableRootOnly::getWithTranslations();
|
||||
|
||||
if (!empty($templatePaths)) {
|
||||
$menu->dropdown(trans('admin/mainMenu.templates'), function ($sub) use ($templatePaths) {
|
||||
$i = 1;
|
||||
foreach ($templatePaths as $id => $name) {
|
||||
$sub->route('templates.overview', $name, ['id' => $id], $i++);
|
||||
}
|
||||
}, 29, ['icon' => 'fa fa-folder-open']);
|
||||
}
|
||||
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
|
||||
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
|
||||
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
|
||||
|
||||
Reference in New Issue
Block a user