use of org.hippoecm.hst.core.sitemenu.HstSiteMenuItem in project hippo by NHS-digital-website.
the class IntranetEssentialsMenuComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
super.doBeforeRender(request, response);
Map<String, SocialMediaLink> socialMediaLinks = new HashMap<>();
HstSiteMenu menu = (HstSiteMenu) request.getAttribute("menu");
if (menu != null) {
for (HstSiteMenuItem item : menu.getSiteMenuItems()) {
if (item.getHstLink() != null) {
String path = item.getHstLink().getPath();
HippoDocument hippoBeanForPath = getHippoBeanForPath(path, HippoDocument.class);
if (hippoBeanForPath instanceof SocialMediaLink) {
socialMediaLinks.put(path, (SocialMediaLink) hippoBeanForPath);
}
}
}
}
request.setAttribute("socialMediaLinks", socialMediaLinks);
}
Aggregations