Created
July 29, 2021 10:27
-
-
Save gerhart92/e885668ff550c2ba6e6e39a6ae10992a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private HubspotSettingsModel GetHubspotSettingsModel(Item dataSource) | |
{ | |
var hubspotConfigItemId = Settings.GetSetting(ConfigItemId); | |
if (string.IsNullOrEmpty(hubspotConfigItemId)) | |
{ | |
hubspotConfigItemId = "{1F0F4461-60CB-4132-94DB-5C93E185FDA8}"; | |
} | |
var hubspotConfigItem = Sitecore.Context.Database.GetItem(hubspotConfigItemId); | |
var portalId = (!string.IsNullOrWhiteSpace(dataSource[Templates.HubspotFormSettings.Fields.HubspotPortalId]) | |
? dataSource[Templates.HubspotFormSettings.Fields.HubspotPortalId] | |
: hubspotConfigItem[Templates.HubspotFormConfig.Fields.PortalId]); | |
var hubspotFormSettings = new HubspotSettingsModel | |
{ | |
Rendering = RenderingContext.CurrentOrNull.Rendering, | |
HubspotPortalId = portalId, | |
HubspotFormId = dataSource[Templates.HubspotFormSettings.Fields.HubspotFormId], | |
ContextItemId = Sitecore.Context.Item.ID.ToString() | |
}; | |
return hubspotFormSettings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment