Set value with FieldBuilder

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Set value with FieldBuilder

dilekciy
Hey,

In my dynamic plugin I'm constructing some fields, such as custom fields, with FieldBuilder*. However, I'm only able to set the default value of this field and not the current value (the large textarea in the image below).

My current code looks as follows

Field permission = FieldBuilder.builder(CustomField.class)
                                                            .dbColumn(DataTypes.LONG_TEXT.value)
                                                           .name("Test Custom Field")
                                                            .variable("testCustomField")
                                                           .defaultValue("Value set by FieldBuilder")
                                                           .sortOrder(1)
                                                          .build();


This results in the following


The deprecated com.dotmarketing.portlets.structure.model.Field contains a setValues() method that can be used to set the value of the 'Value' textarea. See https://dotcms.com/docs/4.1.0/javadocs/com/dotmarketing/portlets/structure/model/Field.html#setValues-java.lang.String-

Can anyone tell me how I can set the 'Value' textarea with the FieldBuilder class?

Thank you!

* = https://dotcms.com/docs/4.1.0/javadocs/com/dotcms/contenttype/model/field/FieldBuilder.html

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/6d506f18-24eb-42af-952d-09caba466971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Set value with FieldBuilder

wezell1
Ack, it looks like the builder interface does not provide that method - but the implementations do.  We use them internally, e.g.


We will get that fixed but in the meantime you can use the concrete impl.


On Wed, Sep 13, 2017 at 4:22 AM, <[hidden email]> wrote:
Hey,

In my dynamic plugin I'm constructing some fields, such as custom fields, with FieldBuilder*. However, I'm only able to set the default value of this field and not the current value (the large textarea in the image below).

My current code looks as follows

Field permission = FieldBuilder.builder(CustomField.class)
                                                            .dbColumn(DataTypes.LONG_TEXT.value)
                                                           .name("Test Custom Field")
                                                            .variable("testCustomField")
                                                           .defaultValue("Value set by FieldBuilder")
                                                           .sortOrder(1)
                                                          .build();


This results in the following


The deprecated com.dotmarketing.portlets.structure.model.Field contains a setValues() method that can be used to set the value of the 'Value' textarea. See https://dotcms.com/docs/4.1.0/javadocs/com/dotmarketing/portlets/structure/model/Field.html#setValues-java.lang.String-

Can anyone tell me how I can set the 'Value' textarea with the FieldBuilder class?

Thank you!

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/6d506f18-24eb-42af-952d-09caba466971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--



3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

   

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAPL0VyHB8vfvh9L7Y%3DEJF_jnTmAWAuR%2BhuKRSKqPsD6bGdOEsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.