public interface ThemeService
Modifier and Type | Method and Description |
---|---|
ThemeDefinition |
findDefaultThemeDefinition() |
ThemeConfiguration |
findThemeById(Long id) |
ThemeDefinition |
findThemeDefinitionById(Long id) |
Map<String,ThemeField> |
findThemeFieldMapByThemeId(Long themeId)
Return a map of the ThemeFields for the passed in ThemeId
|
ThemeConfiguration |
getCurrentTheme() |
String |
getDefaultThemeBaseDirectory()
Returns the default base directory for theme files.
|
String |
getThemeResourceLocation(String resourcePath)
Returns a directory that should be prefixed in front of the resource to find file system based
Theme resources.
|
String |
replaceCssThemeFields(String contents,
ThemeConfiguration tc) |
String |
replaceJsThemeFields(String contents,
ThemeConfiguration tc) |
ThemeConfiguration |
save(ThemeConfiguration themeConfiguration)
Saves a theme to the database
|
void |
setDefaultThemeBaseDirectory(String defaultThemeBaseDirectory)
Sets the default theme base directory.
|
ThemeConfiguration getCurrentTheme()
ThemeConfiguration findThemeById(Long id)
id
- Map<String,ThemeField> findThemeFieldMapByThemeId(Long themeId)
themeId
- ThemeConfiguration save(ThemeConfiguration themeConfiguration)
themeConfiguration
- ThemeDefinition findThemeDefinitionById(Long id)
id
- ThemeDefinition findDefaultThemeDefinition()
String getDefaultThemeBaseDirectory()
void setDefaultThemeBaseDirectory(String defaultThemeBaseDirectory)
defaultThemeBaseDirectory
- String getThemeResourceLocation(String resourcePath)
Spring's SimpleUrlHandlerMapping
is normally used to serve static resources. Broadeaf's
sample application contains URL mapping configuration similar to the following :
blJsResources blCssResources blImageResources blFontResources
If a resource is matched using one of the patterns above, the pattern is stripped off of the request path prior to it being sent to the ThemeFileResourceResolver. For example, "/css/style.css" will come through as just "style.css".
This method looks up the mapping string which is set at HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE by
Spring's AbstractUrlHandlerMapping
which SimpleUrlHandlerMapping
extends.
The resourcePath is passed in for possible override needs but is not used by the default implementation.
The result of this method is to return the proper path to the resource within a themeBaseDirectory. It depends
on both Theme
and Request being set on the BroadleafRequestContext
resourcePath
- String replaceCssThemeFields(String contents, ThemeConfiguration tc)
String replaceJsThemeFields(String contents, ThemeConfiguration tc)
Copyright © 2018. All rights reserved.