/** * Called by the theme negotiation module. * * @return the local theme associated to the current space (workspace, section, ...) as a * 'theme/page' string. Return null otherwise. */ public String getOutcome(Object context) { Boolean useOldThemeConf = Boolean.valueOf(Framework.getProperty(LocalThemeConfig.OLD_THEME_CONFIGURATION_PROPERTY)); if (Boolean.FALSE.equals(useOldThemeConf)) { return null; } DocumentModel currentSuperSpace = (DocumentModel) Component.getInstance("currentSuperSpace"); if (currentSuperSpace == null) { return null; } // Get the placeful local theme configuration for the current // workspace. LocalThemeConfig localThemeConfig = LocalThemeHelper.getLocalThemeConfig(currentSuperSpace); if (localThemeConfig == null) { return null; } // Extract the page path String path = localThemeConfig.computePagePath(); if (path == null) { return null; } // Look up the page PageElement page = Manager.getThemeManager().getPageByPath(path); if (page != null) { return path; } return null; }
public String getCurrentLocalFlavorName() throws ClientException { DocumentModel currentSuperSpace = navigationContext.getCurrentSuperSpace(); if (currentSuperSpace != null) { LocalThemeConfig localThemeConfig = LocalThemeHelper.getLocalThemeConfig(currentSuperSpace); if (localThemeConfig != null) { // extract the flavor String flavor = localThemeConfig.getFlavor(); return flavor; } } return null; }