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=", "}}