Set Master page web part viability to false if child page contains a specific web part.

Gys Rademeyer asked on October 4, 2018 15:20

Good day

I am trying to disable a web part zone called "FooterZone" in my master page when one of the child pages of that master page contains a web part zone called "BreadCrumbs"

I assume it will be done in the visibility section of the web part. However im struggling to get the correct Macro

Correct Answer

Peter Mogilnitski answered on October 4, 2018 17:01

Would it be easier to add hasBreadCrumbs field to your page types that use this master? And then you simply use CurrentPage.hasBreadCrumbs to show/hide your footer section?

P.S. If you are really want the macro you may try to see if your web part present in Template XML {% CurrentDocument.DocumentPageTemplate.PageTemplateWebParts.ToString().Contains("breadcrumb") |(identity)GlobalAdministrator%}. Essenitally you convert the template XML with web parts to string and check if certain string is present or create a custom macro to work with XML :)

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.