#Lightning コンポーネントでコミュニティーか通常の組織環かどうかを見分ける方法
Lightning component .cmp
Apex controller .cls
public with sharing class CustomController {
@AuraEnabled
public static boolean isCommunity(){
Id siteId = Site.getSiteId(); // take a look at the apex class Site, you may find more useful method concerning site/community
if (siteId != null) {
return true;
}
return false;
}
}
Lightning component controller .js
({
init : function(component, event, helper) {
var action = component.get("c.isCommunity");
action.setCallback(this, function(response) {
var isCommunity = response.getReturnValue(); // do any operation needed here
});
$A.enqueueAction(action);
}
})