Skip to content

Commit

Permalink
Preparations for the headless-form-module: currentFormSupplier
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Lemke committed Sep 6, 2021
1 parent 23cd447 commit eb69ddf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public String getFormConfig(@PathVariable CMChannel currentContext,

Navigation navigation = currentContext.getRootNavigation();
request.setAttribute(NavigationLinkSupport.ATTR_NAME_CMNAVIGATION, navigation);
CurrentFormSupplier.setCurrentFormLocale(editor.getContent());
CurrentFormSupplier.setCurrentForm(editor.getContent());

List<FormElement<?>> formElements = formFreemarkerFacade.parseFormElements(editor);
if (formElements.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public FormProcessingResult socialFormAction(@PathVariable(name = "currentContex
modelAndView.addObject(MODEL_ROOT, navigation);
pageResourceBundlesInterceptor.postHandle(request, response, null, modelAndView);
request.setAttribute(NavigationLinkSupport.ATTR_NAME_CMNAVIGATION, navigation);
CurrentFormSupplier.setCurrentFormLocale(target.getContent());
CurrentFormSupplier.setCurrentForm(target.getContent());

List<FormElement<?>> formElements = formFreemarkerFacade.parseFormElements(target);
if (formElements.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public FormEditorAdapter(Content content, FormElementFactory formElementFactory)
public List<FormElement<?>> formElements() {

//The formElements parsers might need the locale of the current site.
CurrentFormSupplier.setCurrentFormLocale(content);
CurrentFormSupplier.setCurrentForm(content);

return FormEditorHelper.parseFormElements(content, formElementFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Content get() {
return currentForm;
}

public static void setCurrentFormLocale(Content currentForm) {
public static void setCurrentForm(Content currentForm) {
ofNullable(RequestContextHolder.getRequestAttributes())
.orElseThrow(() -> new IllegalStateException("No RequestAttributes available, cannot set the currect form"))
.setAttribute(CURRENT_FORM, currentForm, RequestAttributes.SCOPE_REQUEST);
Expand Down

0 comments on commit eb69ddf

Please sign in to comment.