Salesforce主题列表
主题名 | 适用环境 |
---|---|
Theme1 | Obsolete Salesforce theme |
Theme2 | Salesforce Classic 2005 user interface theme |
Theme3 | Salesforce Classic 2010 user interface theme |
Theme4d | Modern “Lightning Experience” Salesforce theme |
Theme4t | Salesforce mobile app theme |
Theme4u | Lightning Console theme |
PortalDefault | Salesforce Customer Portal theme |
Webstore | Salesforce AppExchange theme |
变量 | 说明 |
---|---|
$User.UITheme | 返回用户应该使用的风格 |
$User.UIThemeDisplayed | 返回用户实际使用的风格 ※官方推荐使用 |
例1,Visualforce中的使用示例
1 2 3 4 5 6 7 8 9 |
<apex:page> <apex:pageBlock title="My Content" rendered="{!$User.UIThemeDisplayed == 'Theme2'}"> // this is the old theme... </apex:pageBlock> <apex:pageBlock title="My Content" rendered="{!$User.UIThemeDisplayed == 'Theme3'}"> // this is the classic theme ... </apex:pageBlock> </apex:page> |
例2,JavaScrip中的使用示例
1 2 3 |
function isLightningDesktop() { return UITheme.getUiThemeDisplayed === "Theme4d"; } |
例3,Apex中的使用示例
1 2 3 |
public String getContextUserUiThemeDisplayed() { return UserInfo.getUiThemeDisplayed(); } |
例4,SOQL 以及 API中的使用示例※官方不推荐
1 |
SELECT UserPreferencesLightningExperiencePreferred FROM User WHERE Id = 'CurrentUserId' |