Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

core: optional: install default menu from site config.

When using the empty skeleton, look for a default menu in the site config:

[
        ...
        {skeleton, empty},
        {default_menu, [{menu_item1, []}, {menu_item2, [{submenu_item, []}]}]},
        ...
].
  • Loading branch information...
commit 24898c92242f7902a39906cffc6e5b921f56ea79 1 parent 03136c2
@kaos kaos authored
View
2  modules/mod_menu/mod_menu.erl
@@ -381,7 +381,7 @@ manage_schema(install, Context) ->
{main_menu,
menu,
[{title, <<"Main menu">>},
- {menu, case z_install_defaultdata:default_menu(m_site:get(skeleton, Context)) of
+ {menu, case z_install_defaultdata:default_menu(Context) of
undefined -> [];
Menu -> Menu
end}
View
14 src/install/z_install_defaultdata.erl
@@ -146,11 +146,19 @@ install(_, _) ->
ok.
-%% @doc Retrieve the default menu structure for a given skeleton site. Used by mod_menu to create the menu.
-default_menu(blog) ->
+%% @doc Retrieve the default menu structure for a given site. Used by mod_menu to create the menu.
+default_menu(Context) ->
+ case m_site:get(skeleton, Context) of
+ empty ->
+ m_site:get(default_menu, Context);
+ Skeleton ->
+ default_skeleton_menu(Skeleton)
+ end.
+
+default_skeleton_menu(blog) ->
[{page_home, []}, {page_about, []}, {page_contact, []}];
-default_menu(_) ->
+default_skeleton_menu(_) ->
%% no/unknown skeleton = no default menu
undefined.

3 comments on commit 24898c9

@arjan
Owner

Nice; but why is this only for the "empty" skeleton?

@kaos
Owner

The blog skeleton already has a default menu... other skeletons are yet undefined. But feel free to adapt it further ;)

@kaos
Owner

Aha... maybe move out the default blog skeleton menu to the skeleton config, that way it would get generic regardless of skeleton.

And on the same note, perhaps do that with the modules to install too (the other commit I pushed last night)... as I'm currently pondering on a way to uninstall some of the default installed modules (if I want to replace the acl module, for instance).

Please sign in to comment.
Something went wrong with that request. Please try again.