DreamOn Posted December 28, 2017 Posted December 28, 2017 Hi, Is there a way to add a condition in theme hook? This doesn't work: array ( 'selector' => 'li.ipsDataItem.ipsDataItem_responsivePhoto', 'type' => 'add_attribute', 'attributes_add' => array ( 0 => array ( 'key' => 'data-pinned', 'value' => '{{if $row->mapped(\'pinned\') === 1}}pinned{{endif}}', ), ), ), ParseError: syntax error, unexpected '&' (0) Thanks.
teraßyte Posted December 28, 2017 Posted December 28, 2017 No, on attributes you cannot add conditional checks like IF. I've asked for this kind of support to be added a few times (as well as other developers too). So far nothing has been done about it, maybe in 4.3... but I doubt it's being added in there either You could try working around it with some tricks/hacks, but it depends on what you want to do and where exactly.
DreamOn Posted January 5, 2018 Author Posted January 5, 2018 On 28/12/2017 at 7:35 PM, teraßyte said: No, on attributes you cannot add conditional checks like IF. I've asked for this kind of support to be added a few times (as well as other developers too). So far nothing has been done about it, maybe in 4.3... but I doubt it's being added in there either You could try working around it with some tricks/hacks, but it depends on what you want to do and where exactly. Thanks @teraßyte. I would like to add a html container, from : <div class="test">...</div> to : <div class="container"> <div class="test">...</div> </div> Do you have an idea how I can do this? Thanks.
teraßyte Posted January 5, 2018 Posted January 5, 2018 5 hours ago, DreamOn said: Thanks @teraßyte. I would like to add a html container, from : <div class="test">...</div> to : <div class="container"> <div class="test">...</div> </div> Do you have an idea how I can do this? Thanks. That being the case you cannot use the attribute to add a container. Try instead what I mentioned in your other topic about exporting the hook manually and then modifying it to add only the opening/closing HTML tags separately.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.