Search in sources :

Example 1 with Signup

use of uk.nhs.digital.website.beans.Signup in project hippo by NHS-digital-website.

the class CustomAutoDetectFormComponent method getFormBeanFromSignupDocument.

@Nullable
private FormBean getFormBeanFromSignupDocument(final HstRequest request) {
    final HippoBean document = request.getRequestContext().getContentBean();
    if (document instanceof Signup) {
        final Signup signupDocument = (Signup) document;
        return (FormBean) signupDocument.getFormLink().getLink();
    }
    if (document == null || !document.isHippoDocumentBean() || !(document instanceof FormBean)) {
        if (log.isDebugEnabled()) {
            log.warn("*** EFORMS ***");
            log.warn("Cannot get the form bean, returning null. Reason: the content bean is null or it does not match the FormBean type [eforms:form].");
            log.warn("Override the method [BaseEformComponent#getFormBean(HstRequest)] to get the form bean in a different way, e.g. from a linked bean.");
            log.warn("Will attempt to get the form bean from the component picker.");
            log.warn("*** EFORMS ***");
        }
        return null;
    }
    return (FormBean) document;
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) Signup(uk.nhs.digital.website.beans.Signup) FormBean(com.onehippo.cms7.eforms.hst.beans.FormBean) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FormBean (com.onehippo.cms7.eforms.hst.beans.FormBean)1 HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 Nullable (org.jetbrains.annotations.Nullable)1 Signup (uk.nhs.digital.website.beans.Signup)1