Search in sources :

Example 1 with NavigationBlockComponentInfo

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

the class NavigationBlockComponent method doBeforeRender.

@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
    super.doBeforeRender(request, response);
    NavigationBlockComponentInfo componentInfo = getComponentParametersInfo(request);
    final String theme = componentInfo.getTheme();
    final String size = componentInfo.getSize();
    final String position = componentInfo.getPosition();
    final String heading = componentInfo.getHeading();
    List<HippoBean> allDocuments = new ArrayList<>();
    HippoBean document1 = getHippoBeanForPath(componentInfo.getDocument1(), HippoBean.class);
    allDocuments.add(document1);
    HippoBean document2 = getHippoBeanForPath(componentInfo.getDocument2(), HippoBean.class);
    allDocuments.add(document2);
    HippoBean document3 = getHippoBeanForPath(componentInfo.getDocument3(), HippoBean.class);
    allDocuments.add(document3);
    HippoBean document4 = getHippoBeanForPath(componentInfo.getDocument4(), HippoBean.class);
    allDocuments.add(document4);
    HippoBean document5 = getHippoBeanForPath(componentInfo.getDocument5(), HippoBean.class);
    allDocuments.add(document5);
    HippoBean document6 = getHippoBeanForPath(componentInfo.getDocument6(), HippoBean.class);
    allDocuments.add(document6);
    request.setAttribute("theme", theme);
    request.setAttribute("size", size);
    request.setAttribute("position", position);
    request.setAttribute("heading", heading);
    request.setAttribute("documents", buildDocumentsList(allDocuments));
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) ArrayList(java.util.ArrayList) NavigationBlockComponentInfo(uk.nhs.digital.common.components.info.NavigationBlockComponentInfo)

Aggregations

ArrayList (java.util.ArrayList)1 HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 NavigationBlockComponentInfo (uk.nhs.digital.common.components.info.NavigationBlockComponentInfo)1