ACF Checkbox Field properties

Hi Team,

Are there any parameters in CS Dynamic Content field format or TWIG that can change the default separator for ACF in its Checkbox Field array? It has a comma by default but without a space. It would be nice to be able to adjust it without custom coding.

Currently I output Checkbox Field array values with default string format: {{dc:looper:field key="array"}}

Hello John,

Thanks for writing in! You can test this Twig code:

{{ looper.field({"key":"my_array", "delimiter":", "}) }}

Make sure to change the name of the field.

Thanks @ruenel,

It works but with the following syntax: {{dc:looper:field key="my_array", delimiter=", "}}
If I use yours the data output I get is 'Array'

What does that mean? Is TWIG not set up correctly (server runs PHP 8.4), or do I need to change the syntax for Looper Providers? The field is located within the nested Group Field. Shouldn’t it work with both syntax versions?

My ACF structure is this:
Group Field
** Nested Group Filed
*** Checkbox Field with multiple options

So my layout has:
DIV with Group FIeld Looper Provider (Dynamic Content {{dc:acf:post_field field="event_weights"}} )
** DIV with nested Group Field Looper Provider + Nested Field Looper Consumer (Dynamic Content {{dc:acf:post_field field="event_weights_sport"}} )
*** Text Element with the Checkbox Field array output ( {{dc:looper:field key="ss_m_kids_11_12", delimiter=", "}} )

Hey @referee,

In Cornerstone, the difference between the two syntaxes comes down to how the data is processed after it’s retrieved.

1. What does the “Array” output mean?

When you see the text “Array” in Twig, it means that the code successfully retrieved the data, but that data is a raw PHP Array.

In PHP (especially in newer versions like 8.4), when you try to output an array as a string without specifically formatting it, it often results in the literal string "Array".

2. Why does the DC syntax work but Twig doesn’t?

The two systems use different “pipelines” for the data:

  • Dynamic Content ({{dc:looper:field ...}}): This goes through Cornerstone’s internal string processor. This processor has a specific rule: if the result is an array, join it into a string using the delimiter parameter (which defaults to a comma). This is why your DC tag works perfectly.
  • Twig ({{ looper.field(...) }}): This is a direct “bridge” to the raw data. When you call this in Twig, Cornerstone returns the actual PHP array to the Twig engine. Twig then attempts to print that array directly. Crucially, the delimiter parameter you passed inside the parentheses is passed to the data-fetching function, but Twig itself doesn’t use that parameter to format the output—it expects you to use Twig filters for that.

3. How to fix the Twig syntax

To get the same result in Twig, you should use Twig’s native join filter. This is actually more powerful because it’s part of the standard Twig language:

{{ looper.field({"key":"ss_m_kids_11_12"}) | join(", ") }}

4. Is there a global parameter for the default separator?

There is no UI setting or global parameter in Cornerstone/Pro to change the default separator (comma) for all Dynamic Content tags at once. It is hardcoded as a fallback in the theme’s core logic.

Recommendation:
Since you are already using a Text Element, the most “Cornerstone-native” way to handle this without extra Twig filters is to stick with the DC syntax you found:
{{dc:looper:field key="ss_m_kids_11_12", delimiter=", "}}

1 Like

Hey @christian,

Thank you very much for such a detailed and structured explanation. I will try to experiment with TWIG filters for sure to understand the difference better. But in this particular instance I perfectly undestand the preference of using DC syntax.

Thanks again for sharing this info.

You are most welcome, John.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.