Enrique Perez wrote:
> Hi!
>
> I want to create a new fragment and I need to design new properties to
> modify this fragment when I edit it.
>
> How can I do this?
>
> Thank you all!
>

Hi,

you can look into nxthemes-fragments/ there are examples of fragments there.

the properties are read from the Fragment class where there is a
decorator (@FieldInfo), e.g.


package org.nuxeo.theme.fragments;

import org.nuxeo.theme.models.Html;
import org.nuxeo.theme.models.Model;
import org.nuxeo.theme.properties.FieldInfo;

public final class TextFragment extends AbstractFragment {

    @FieldInfo(type = "text area", label = "text")
    public String text = "Text here ...";

    public TextFragment() {
        super();
    }

    public TextFragment(String text) {
        super();
        this.text = text;
    }

    @Override
    public Model getModel() {
        return new Html(text);
    }

}


fragments are then registered in:

  <extension target="org.nuxeo.theme.services.ThemeService"
point="fragments">

    <fragment name="text fragment">
      <class>org.nuxeo.theme.fragments.TextFragment</class>
      <model-type>html</model-type>
      <dynamic>false</dynamic>
    </fragment>

  </extension>


you then need to register a <view> that matches the <model-type>, or you
can simply use the existing ones.

FRAGMENT ---  provides ---> MODEL ----- is rendered with ---> VIEW

best
/JM
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to