将CQ5表单重用到mywebsite组件中不会显示“表单末尾”部分 [英] Reusing the CQ5 Form into the mywebsite components is not showing up the End of the Form section

查看:71
本文介绍了将CQ5表单重用到mywebsite组件中不会显示“表单末尾”部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将表单重新使用到我的项目组件中。
我已将整个表单文件夹从 / libs / foundation / components / form 复制粘贴到我的项目 / apps / mywebsite / components / form
但是,当我尝试在parsys中使用mywebsite中的表单时,from仅显示from的开始。
当我试图在同一页面parsys中使用基础中的表单时,它同时显示了表单的开始和结束。
观察:
从内容中,当我使用基础形式时,在页面内容中,我可以看到起始节点和结束节点。就像当我使用mywebsite表单启动节点时一样。

I am trying to reuse the Form into my project components. I have copy pasted the entire form folder from "/libs/foundation/components/form" to my project "/apps/mywebsite/components/form". But when i am trying to use the form from mywebsite in the parsys the from shows only Start of the from. Where as when i tried to use the form from the foundation in the same page parsys it shows both Start and End of the form. Observation: From the content, when i am using the foundation form the in the page content i can see the start and end nodes. where as when i am using the mywebsite form start node alone is created.

推荐答案

表单结尾已添加/由 FormParagraphPostProcessor 类的fixStructure()方法删除。该后处理器监听表单开始和表单结束段落的创建和删除,并相应地创建/删除其他段落。

The form end is added/deleted by the fixStructure() method of the FormParagraphPostProcessor class. This post processor listens for creation and deletion of form start and form end paragraph and creates/removes the other paragraphs accordingly.

if ( ResourceUtil.isA(res, FormsConstants.RT_FORM_BEGIN)
    || ResourceUtil.isA(res, FormsConstants.RT_FORM_END)) {
    if ( FormsHelper.checkFormStructure(res) != null ) {
        logger.debug("Fixed forms structure at {}", contentResource.getPath());
    }
}else {
    fixStructure(res);
}

此类取决于 FormConstants.java 表单开始(RT_FORM_BEGIN)和表单结束(RT_FORM_END)分别定义为基础/组件/表单/开始和基础/组件/表单/结束。因此,后处理器不会处理项目中存在的表单开始/结束。

This class depends on the FormConstants.java where the form start(RT_FORM_BEGIN) and the form end(RT_FORM_END) are defined as "foundation/components/form/start" and "foundation/components/form/end" respectively. Due to this the post processor doesn't process the form start / end that is present within your project.

要使自定义表单组件正常工作,您可以考虑使用以下一种方法:以下可能的选项:

To make your custom form component working you may consider one of the following possible options:


  1. 为您的项目表单添加 sling:resourceSuperType 属性,其开头为 foundation / components / form / start 。这将创建一个表单结尾,但类型为 foundation / components / form / end ,而不是您的项目表单结尾。

  1. Add the sling:resourceSuperType property for your project form start as "foundation/components/form/start". This would create a form end, but it would be of type foundation/components/form/end and not your project form end.

如果您不希望默认表单结尾而是自定义表单结尾,则可能需要创建一个自定义后处理器,以监听表单的开始和结尾并相应地修复结构。这需要修改其他一些Java类,例如 FormsHelper.java 等,因为它们也依赖于FormConstants.java。还要确保相应地更改了start.jsp中的导入。

In case you do not want the default form end but your custom form end, then you may need to create a custom post processor which listens to your form start and end and fix the structure accordingly. This requires modifying few other java classes like FormsHelper.java etc, as they are also dependent on the FormConstants.java. Also make sure that the imports in the start.jsp are changed accordingly.

最后,如果您不想创建自定义类,则可以复制默认值。表单从 / apps / foundation / components / form / start开始,然后在其上进行修改。但是,使用此方法时需要小心,因为这是全局更改,并且会影响使用默认基础表单start的其他项目。

Finally, if you do not want to create custom classes, you can copy the default form start to "/apps/foundation/components/form/start" and make your modifications on top of it. But you need to be careful while using this approach as this is a global change and would affect the other projects that are using the default foundation form start.

这篇关于将CQ5表单重用到mywebsite组件中不会显示“表单末尾”部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆