lundi 23 mars 2015

Twig: how to write if in_array

I have the following php statement:



<?php if(in_array(get_theme_mod('navbar_position'), array('under-header', 'bottom-of-header'))) { ?>


I'd like to convert it for use with Twig (I'm using twig to build a wordpress theme), I have found this code snippet but not too sure how to adapt it for what I need:



{% if myVar in someOtherArray|keys %}


Would it be something like this:



{% if theme.theme_mod('navbar_position') in 'under-header', 'bottom-of-header'|keys %}


...a bit of a stab in the dark.


Aucun commentaire:

Enregistrer un commentaire