Search code examples
jsonattributesplonethemingdiazo

Diazo theme with json attributes error: "Attribute 'data-plugin-options': Failed to compile the expression"


I have a static theme that contains some json attributes for customizing jquery plugins, like

data-plugin-options='{"directionNav":false, "animation":"slide", "slideshow": false, "maxVisibleItems": 6}'

diazo compiler complains about this like

Invalid expression [0:0]
compilation error, element 'div' [400:0]
Attribute 'data-plugin-options': Failed to compile the expression ''directionNav':false, 'animation':'slide', 'slideshow': false, 'maxVisibleItems': 6' in the AVT. [0:0]
Invalid expression [0:0]
compilation error, element 'div' [445:0]
Attribute 'data-plugin-options': Failed to compile the expression ''directionNav':false, 'animation':'slide'' in the AVT. [0:0]
Invalid expression [0:0]
compilation error, element 'div' [512:0]
Attribute 'data-plugin-options': Failed to compile the expression ''controlNav':false, 'slideshow': false, 'animationLoop': true, 'animation':'slide'' in the AVT. [0:0]

and breaks the rendering.

Is there a way for making this work (beside moving the conf to js)?


Solution

  • It seems the only solution - and that actually make sense - is to split the parameters in more than one data attribute. Like:

    data-plugin-directionNav="false"
    data-plugin-animation="slide"
    data-plugin-slideshow="false"
    data-plugin-maxVisibleItems="6"