{% import "macros/widgets.html.twig" as widgets %} {% if section.title %} {{ widgets.page_header(section.title) }} {% endif %} {% set width = section.widgets|length %} {% set rawWidth = 12 / width %} {% set columnWidth = rawWidth|round(0, 'floor') %}
{% for widget in section.widgets %} {% set columnSize = columnWidth %} {% if width == 5 and (loop.first or loop.last) %} {% set columnSize = columnWidth + 1 %} {% endif %}
{% set data = widget.data %} {% if widget.dataType == constant('App\\Model\\Widget::DATA_TYPE_DURATION') %} {% set data = widget.data|duration %} {% elseif widget.dataType == constant('App\\Model\\Widget::DATA_TYPE_MONEY') %} {% set data = widget.data|money %} {% endif %} {% set url = null %} {% if widget.route %} {% set url = path(widget.route, widget.routeOptions) %} {% endif %} {% set embedOptions = {data: data, title: widget.title, icon: widget.icon, color: widget.color, url: url} %} {% embed 'embeds/widget-'~widget.type~'.html.twig' with embedOptions %}{% endembed %}
{% endfor %}