Skip to content

Commit 56eacb2

Browse files
authored
Merge pull request #1173 from vascoazevedo08/dev-pnp
Rever commit 26bf318 and refactor Safely apply footer DisplayName in Provision Site Footer
2 parents 0ed8002 + eabbeba commit 56eacb2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectSiteFooterSettings.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplat
4646
var chrome = pnpCoreContext.Web.GetBrandingManager().GetChromeOptions();
4747

4848
footer.Enabled = chrome.Footer.Enabled;
49-
// Avoid setting a null DisplayName, which causes errors if the footer was previously enabled.
50-
// This can happen when a user disables the footer after it was set.
51-
// Only update if DisplayName is present in the template.
52-
if (template.Footer.DisplayName != null)
53-
{
54-
chrome.Footer.DisplayName = template.Footer.DisplayName;
55-
}
49+
footer.DisplayName = chrome.Footer.DisplayName;
5650
footer.Layout = (PnP.Framework.Provisioning.Model.SiteFooterLayout)Enum.Parse(typeof(PnP.Framework.Provisioning.Model.SiteFooterLayout), chrome.Footer.Layout.ToString());
5751
footer.BackgroundEmphasis = (PnP.Framework.Provisioning.Model.Emphasis)Enum.Parse(typeof(PnP.Framework.Provisioning.Model.Emphasis), chrome.Footer.Emphasis.ToString());
5852
}
@@ -375,7 +369,13 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ
375369
var chrome = pnpCoreContext.Web.GetBrandingManager().GetChromeOptions();
376370

377371
chrome.Footer.Enabled = web.FooterEnabled;
378-
chrome.Footer.DisplayName = template.Footer.DisplayName;
372+
// Avoid setting a null DisplayName, which causes errors if the footer was previously enabled.
373+
// This can happen when a user disables the footer after it was set.
374+
// Only update if DisplayName is present in the template.
375+
if (template.Footer?.DisplayName != null)
376+
{
377+
chrome.Footer.DisplayName = template.Footer.DisplayName;
378+
}
379379
chrome.Footer.Layout = (PnP.Core.Model.SharePoint.FooterLayoutType)Enum.Parse(typeof(PnP.Core.Model.SharePoint.FooterLayoutType), template.Footer.Layout.ToString());
380380
chrome.Footer.Emphasis = (PnP.Core.Model.SharePoint.FooterVariantThemeType)Enum.Parse(typeof(PnP.Core.Model.SharePoint.FooterVariantThemeType), template.Footer.BackgroundEmphasis.ToString());
381381

0 commit comments

Comments
 (0)