patternengine-php-twig icon indicating copy to clipboard operation
patternengine-php-twig copied to clipboard

List Items JSON not pulling through

Open magnition-ci opened this issue 8 years ago • 1 comments

I've been having issues with using any custom list items in loops within the PHP and Twig Patternlab. So far I have tried adding the JSON content both within the Pattern partials folders and also within the data folder but neither seem to be picked up within my templates and I get empty arrays rendering. I only seem to be able to use the standard data setup within the listitems.json in the data folder but even when I try to add new data to that file it still does not pick up. Is there something I am missing or is this possibly a bug?

JSON Data { "1" : { "coreplans" : { "id" : "silver", "plantitle" : "Silver", "summary" : "Some description text here for the silver level", "atoms-ticked" : { "one": "List item one", "two": "List item two", "three": "List item three", "four": "List item four" } } }, "2" : { "coreplans" : { "id" : "gold", "plantitle" : "Gold", "summary" : "Some description text here for the gold level", "atoms-ticked" : { "one": "List item one", "two": "List item two", "three": "List item three", "four": "List item four" } } }, "3" : { "coreplans" : { "id" : "platinum", "plantitle" : "Platinum", "summary" : "Some description text here for the platinum level", "atoms-ticked" : { "one": "List item one", "two": "List item two", "three": "List item three", "four": "List item four" } } } }

Twig loop within the template {% for item in 1..3 %} <div class="col-sm-4"> {% include "molecules-block-plan" %} </div> {% endfor %}

Molecule block example `

{% include "atoms-label-small" %}
{% include "atoms-h3" %}
{% include "atoms-paragraph" %} {% include "atoms-ticked-plans" %} Explore all {{ coreplans.plantitle }} benefits {% include "atoms-button" %}
`

magnition-ci avatar Sep 12 '16 13:09 magnition-ci

I have the same issue with the mustache Version of Patternlab. Maybe it's not planned to use more listitem-Files in the _data Folder.

regards

MacKP avatar Oct 19 '16 09:10 MacKP