pattern-lab / patternengine-php-twig

Twig-based PatternEngine for Pattern Lab.
http://patternlab.io/
MIT License
78 stars 36 forks source link

List Items JSON not pulling through #30

Open magnition-ci opened 8 years ago

magnition-ci commented 8 years ago

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 %}

{% include "molecules-block-plan" %}
            {% 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" %}

`

MacKP commented 7 years ago

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