Draft: HCP Make SessionHomeModule configurable
This is a draft, do not start it yet :D
SessionModule adds a menu entry and home page entry. The goal now is to configure if and at which position the module provides these entries – at the moment the module determines this completely on it's own.
Add a static method provideEntries(config?: )
to the module expecting an optional value of an interface like this:
export interface SessionHomeModuleConfig {
mainMenuEntry?: boolean | number,
homePageEntry?: boolean | number
}
If provideEntries(...)
is not used when importing SessionModule, do not provide main menu entries or home page entries.
If provideEntries()
is used without parameter, provide all entries as already defined in the module file.
Use provideMainMenuEntry()
and provideHomePageEntry()
in that static method.
Main menu entries:
- If
config.provideMenuEntry
is undefined or false do not provide any main menu entry. - If
config.provideMenuEntry
is true use the MenuEntry as already defined in the module file - If
config.provideMenuEntry
is a number use the MenuEntry as already defined in the module file, but replace position value with the given number.
Home page entries:
- If
config.provideHomePageEntry
is undefined or false do not provide any home page entry. - If
config.provideHomePageEntry
is true use the HomePageEntry objects as already defined in the module file. - If
config.provideHomePageEntry
is a number use the HomePageEntry objects as already defined in the module file, but replace their position value with the given number.
The home page entries come with a special case: Their position value is a function than can return null
– meaning not to display them at all. Please leave these function intact, since only one of the two home page entries is supposed to be present at a time. See if you can find a way to replace the number value with the value given by `config.provideHomepageEntry' in case they are displayed
Requirements
-
When imported in features.module.ts
of the HCP(doc) variant, you can useSessionHomeModule.provideEntries(...)
to configure the positions of the menu and home page entries.
Notes
- Angular used to put weird restriction on the code you can pace in static module methods. That may cause confusing errors.
- Changes are only relevant to the HCP(doc) variant. So serving doc is enough to check the homepage and the menu for results.