use of com.day.cq.wcm.foundation.forms.FormStructureHelper in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContainerImpl method initModel.
@PostConstruct
private void initModel() {
FormStructureHelper formStructureHelper = formStructureHelperFactory.getFormStructureHelper(resource);
request.setAttribute(FormsHelper.REQ_ATTR_FORM_STRUCTURE_HELPER, formStructureHelper);
this.action = currentPage.getPath() + ".html";
if (StringUtils.isBlank(id)) {
id = FormsHelper.getFormId(request);
}
this.name = id;
this.dropAreaResourceType += "/new";
if (redirect != null) {
String contextPath = request.getContextPath();
if (StringUtils.isNotBlank(contextPath) && redirect.startsWith("/")) {
redirect = contextPath + redirect;
}
}
if (!StringUtils.equals(request.getRequestPathInfo().getExtension(), Constants.EXPORTER_EXTENSION)) {
runActionTypeInit(formStructureHelper);
}
}
use of com.day.cq.wcm.foundation.forms.FormStructureHelper in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContainerImpl method initModel.
@PostConstruct
private void initModel() {
FormStructureHelper formStructureHelper = formStructureHelperFactory.getFormStructureHelper(resource);
request.setAttribute(FormsHelper.REQ_ATTR_FORM_STRUCTURE_HELPER, formStructureHelper);
this.action = linkHandler.getLink(currentPage).map(Link::getURL).orElse(null);
String formId = FormsHelper.getFormId(request);
if (StringUtils.isBlank(id)) {
id = formId;
}
request.setAttribute(FormsHelper.REQ_ATTR_FORMID, getId());
this.name = id;
this.dropAreaResourceType = "wcm/foundation/components/responsivegrid/new";
if (redirect != null) {
String contextPath = request.getContextPath();
if (StringUtils.isNotBlank(contextPath) && redirect.startsWith("/")) {
redirect = contextPath + redirect;
}
}
if (!StringUtils.equals(request.getRequestPathInfo().getExtension(), ExporterConstants.SLING_MODEL_EXTENSION)) {
runActionTypeInit(formStructureHelper);
}
final ValidationInfo info = ValidationInfo.getValidationInfo(request);
if (info != null) {
this.errorMessages = info.getErrorMessages(null);
}
}
use of com.day.cq.wcm.foundation.forms.FormStructureHelper in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TextImplTest method setUp.
@Before
public void setUp() {
Page page = context.currentPage(CONTAINING_PAGE);
slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class.getName());
slingBindings.put(WCMBindings.CURRENT_PAGE, page);
context.registerService(FormStructureHelperFactory.class, new FormStructureHelperFactory() {
@Override
public FormStructureHelper getFormStructureHelper(Resource formElement) {
return null;
}
});
FormsHelperStubber.createStub();
}
Aggregations