Search in sources :

Example 6 with HippoDocument

use of org.hippoecm.hst.content.beans.standard.HippoDocument in project hippo by NHS-digital-website.

the class SocialMediaComponent method doBeforeRender.

@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
    super.doBeforeRender(request, response);
    final SocialMediaComponentInfo componentParametersInfo = getComponentParametersInfo(request);
    List<HippoDocument> socialMediaItems = getSocialMediaItems(componentParametersInfo);
    request.setAttribute("socialmedia", socialMediaItems);
    String title = componentParametersInfo.getTitle();
    request.setAttribute("title", title);
}
Also used : HippoDocument(org.hippoecm.hst.content.beans.standard.HippoDocument) SocialMediaComponentInfo(uk.nhs.digital.common.components.info.SocialMediaComponentInfo)

Example 7 with HippoDocument

use of org.hippoecm.hst.content.beans.standard.HippoDocument 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);
}
Also used : HippoDocument(org.hippoecm.hst.content.beans.standard.HippoDocument) HashMap(java.util.HashMap) HstSiteMenu(org.hippoecm.hst.core.sitemenu.HstSiteMenu) SocialMediaLink(uk.nhs.digital.website.beans.SocialMediaLink) HstSiteMenuItem(org.hippoecm.hst.core.sitemenu.HstSiteMenuItem)

Aggregations

HippoDocument (org.hippoecm.hst.content.beans.standard.HippoDocument)7 HashMap (java.util.HashMap)1 HstQuery (org.hippoecm.hst.content.beans.query.HstQuery)1 QueryException (org.hippoecm.hst.content.beans.query.exceptions.QueryException)1 BaseFilter (org.hippoecm.hst.content.beans.query.filter.BaseFilter)1 Filter (org.hippoecm.hst.content.beans.query.filter.Filter)1 HippoBeanIterator (org.hippoecm.hst.content.beans.standard.HippoBeanIterator)1 HstRequestContext (org.hippoecm.hst.core.request.HstRequestContext)1 HstSiteMenu (org.hippoecm.hst.core.sitemenu.HstSiteMenu)1 HstSiteMenuItem (org.hippoecm.hst.core.sitemenu.HstSiteMenuItem)1 AzListComponentInfo (uk.nhs.digital.common.components.info.AzListComponentInfo)1 CardListComponentInfo (uk.nhs.digital.common.components.info.CardListComponentInfo)1 HeaderComponentInfo (uk.nhs.digital.common.components.info.HeaderComponentInfo)1 ListPickerComponentInfo (uk.nhs.digital.common.components.info.ListPickerComponentInfo)1 SocialMediaComponentInfo (uk.nhs.digital.common.components.info.SocialMediaComponentInfo)1 SocialMediaLink (uk.nhs.digital.website.beans.SocialMediaLink)1