Reputation: 223
Here is my code block, I want to pass the service
variable to component.
{% for service in services %}
<div data-service="#development"
class="col-md-4 col-sm-6 wow fadeInUp"
data-wow-duration="300ms"
data-wow-delay="0ms"
>
<div class="media service-box">
<div class="pull-left">
<i class="fa fa-line-chart"></i>
</div>
<div class="media-body">
{% component 'editable' file={{ service }} %}
</div>
</div>
</div><!--/.col-md-4-->
{% endfor %}
Thanks,
Upvotes: 3
Views: 1529
Reputation: 1139
Inside {% .. %}
directives you can simply use twig variable names without the double curly braces {{ .. }}
around them. The {{ .. }}
braces just designate twig expressions wheras {% .. %}
designates twig statements. See twig templating documentation. Inside both twig variables can be simply accessed by their names.
So here you could just do like
{% component 'editable' file=service %}
Upvotes: 3
Reputation:
This is a sample from the code I'm using on Page element:
{% set shortDsc %}{{ details.shortDescription|raw }}{% endset %}
{% set productCode %}{{ details.productCode }}{% endset %}
{% set ContentID %}{{ calID }}{% endset %}
{% content ContentID
shortDesc = shortDsc
prodCode = productCode
%}
... and then in Component just use variables as
{prodCode} {shortDesc}
Upvotes: 2