Add source button to Magnolia CMS richText control

我怕爱的太早我们不能终老 提交于 2019-12-13 06:37:52

问题


I need to enable source button on my richText control ( I have to put there HTML code ) and I have follow this tutorial: https://documentation.magnolia-cms.com/display/DOCS/Rich+text

So I have added following settings source - true - Boolean in standard-templating-kit/dialogs/generic/controls/text but it doesn't work for me.

I'm using Magnolia CMS 5.2.4. Can anybody please tell me how I can turn on this button or maybe if there is another control to put there html code ?

Best Regards Jan


回答1:


Have you defined your dialogs using Blossom? If so, they are completely distinct from the STK dialogs. If you have something like the following example, you will need to change your code to set up the rich text area with a source button.

@TabFactory("heading")
public void headingTab(UiConfig cfg, TabBuilder tab) {

    FieldConfig fields = cfg.fields;

    tab.fields(
        fields.text("headingtitle").i18n().required(),
        fields.richText("headingtext").i18n().required()
    );
}

The above example would be modified by defining the rich text field and then modifying the definition.

@TabFactory("heading")
public void headingTab(UiConfig cfg, TabBuilder tab) {

    FieldConfig fields = cfg.fields;

    RichTextFieldBuilder richText = fields.richText("headingtext").i18n().required();
    richText.definition().setSource(true);

    tab.fields(
        fields.text("headingtitle").i18n().required(),
        richText
    );
}


来源:https://stackoverflow.com/questions/31224875/add-source-button-to-magnolia-cms-richtext-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!