Using arrays in configuration APIUsing arrays in configuration APIhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1214878512024-03-28T23:57:27Z2024-03-28T23:57:27ZRE: RE: Using arrays in configuration APIRussell Bohlhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214891762022-08-04T17:44:59Z2022-08-04T17:44:59Z<p>That's interesting. Thanks for following up.</p>Russell Bohl2022-08-04T17:44:59ZRE: Using arrays in configuration APISteve Weisshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214891112022-08-04T17:41:12Z2022-08-04T17:39:38Z<p>I think I've identified what the problem was. Originally, the method
in the configuration interface was "workflowStates()". When
I changed it to "workFlowStates()" it worked. Change it back
and it doesn't work. So I'm guessing that there must be some kind of
naming conflict with the Liferay workflow.</p>Steve Weiss2022-08-04T17:39:38ZRE: RE: Using arrays in configuration APISteve Weisshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214890532022-08-04T16:26:40Z2022-08-04T16:26:39Z<p>Thanks again Russell. I copied your code in and made some changes and
now it works. I have no idea what the problem was.</p>Steve Weiss2022-08-04T16:26:39ZRE: Using arrays in configuration APIRussell Bohlhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214889232022-08-04T16:26:42Z2022-08-04T15:32:04Z<p>Steve, I tested on 7.2 GA2 and I was able to use a String array with
defaults, and I see the defaults properly represented in System Settings:</p>
<p>
<img alt="" src="/documents/d/guest/defaults-1-png?imagePreview=1" /></p>
<pre>
<code class="language-java"> @Meta.AD(deflt = "serif|cursive|other-types", required = false)
public String[] fontFamilies();
</code></pre>
<p>
<br /> </p>Russell Bohl2022-08-04T15:32:04ZRE: RE: Using arrays in configuration APISteve Weisshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214886452022-08-03T15:48:11Z2022-08-03T15:48:11Z<p>Thanks Russell. Still doesn't work though. The other values from the
configuration come through but the list from that field is empty. The
configuration screen in the control panel for that field is shown in
the attached screenshot. So it recognizes the field as an array and
allows me to add additional items, but it's not getting the default list.</p>
<p>
<img alt="" src="/documents/d/guest/screen-shot-2022-08-03-at-11-42-10-am-png?imagePreview=1" />
<br /> </p>Steve Weiss2022-08-03T15:48:11ZRE: Using arrays in configuration APIRussell Bohlhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214885162022-08-03T14:45:00Z2022-08-03T14:45:00Z<p>Hmm, the String array with defaults (like you're trying) works for me
in 7.4--I can set the defaults in the configuration interface, deploy
the module, and retrieve the configuration using
ConfigurationPorivderUtil from a Groovy script. And there are plenty
of examples in Liferay's 7.2 source code where the default is set as
you are doing it. I guess my first thought is to make sure you're on
the latest 7.2 release. And, as a shot in the dark, what if you remove
the hyphens just as a test, to make sure there's not something going
on with odd characters?</p>Russell Bohl2022-08-03T14:45:00ZUsing arrays in configuration APISteve Weisshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1214878502022-08-02T00:50:15Z2022-08-02T00:50:14Z<p>We are using the configuration API for our applications after moving
to 7.x. We have an application that has a list of items, administrator
should be able to configure the application to use one or more of the
items in the list. In our configuration interface, if we do this it works:</p>
<p> </p>
<p> @Meta.AD(<br /> required = false,<br />
name = "Workflow States",<br /> optionValues =
{<br /> "Draft",<br />
"Group",<br />
"Summary",<br />
"Reclaima",<br /> "Board
Review",<br />
"Closed-Duplicated",<br />
"Closed-Withdrawn",<br />
"Closed-Completed",<br />
"Closed-Rejected",<br />
"Withdrawn",<br />
"Rejected"<br /> })<br /> public String[]
workflowStates();<br /> </p>
<p>Doing it this way, in the control panel the user can select from an
option menu and add as many items from the list as he/she wishes. The
problem is that if someone doesn't do the control panel configuration
first, then configuration.workflowStates() returns an empty array. We
would like to have a default list. In the tutorial
(https://help.liferay.com/hc/en-us/articles/360018161391-Making-Your-Applications-Configurable-),
this appears to be the way to do this:</p>
<p> </p>
<p> @Meta.AD(<br /> required = false,<br />
name = "Workflow States",<br /> deflt =
"Draft|Group|Summary|Reclaima|Board
Review|Closed-Duplicated|Closed-Withdrawn|Closed-Completed|Closed-Rejected|Withdrawn|Rejected"<br /&