Search in sources :

Example 1 with HeaderComponentInfo

use of uk.nhs.digital.common.components.info.HeaderComponentInfo in project hippo by NHS-digital-website.

the class HeaderComponent method doBeforeRender.

@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
    super.doBeforeRender(request, response);
    final HeaderComponentInfo componentParametersInfo = getComponentParametersInfo(request);
    String bannerDocPath = componentParametersInfo.getBannerDoc();
    HippoDocument banner = this.getHippoBeanForPath(bannerDocPath, HippoDocument.class);
    request.setAttribute("banner", banner);
    String colour = componentParametersInfo.getColour();
    if ("Dark Blue".equalsIgnoreCase(colour)) {
        request.setAttribute("colour", "Dark Blue Multicolour");
    } else {
        request.setAttribute("colour", colour);
    }
    String digiblockPosition = componentParametersInfo.getDigiblockPosition();
    request.setAttribute("digiblockposition", digiblockPosition);
    String alignment = componentParametersInfo.getAlignment();
    request.setAttribute("alignment", alignment);
    String button1text = componentParametersInfo.getButton1Text();
    String button1Url = componentParametersInfo.getButton1Url();
    request.setAttribute("button1Text", button1text);
    request.setAttribute("button1Url", button1Url);
    String button2text = componentParametersInfo.getButton2Text();
    String button2Url = componentParametersInfo.getButton2Url();
    request.setAttribute("button2Text", button2text);
    request.setAttribute("button2Url", button2Url);
    request.getRequestContext().setAttribute("headerPresent", true);
    request.setAttribute("stripTagsContentRewriter", stripTagsContentRewriter);
    DocumentUtils.setMetaTags(request, this);
}
Also used : HippoDocument(org.hippoecm.hst.content.beans.standard.HippoDocument) HeaderComponentInfo(uk.nhs.digital.common.components.info.HeaderComponentInfo)

Aggregations

HippoDocument (org.hippoecm.hst.content.beans.standard.HippoDocument)1 HeaderComponentInfo (uk.nhs.digital.common.components.info.HeaderComponentInfo)1