{% macro data_table_column_modal(name, columns) %} {% endmacro %} {% macro datatable_header(tableName, columns, query, options) %} {% if query is not null %} {% set orderBy = options.orderBy|default(query.orderBy) %} {% set order = query.order|lower %} {% else %} {% set orderBy = false %} {% set order = false %} {% endif %} {% set striped = options.striped ?? false %} {% set bordered = options.bordered ?? false %} {% set reloadEvent = options.reload|default('') %} {% set translationDomain = options.translationDomain|default('messages') %} {% set translationPrefix = options.translationPrefix ?? 'label.' %} {% set boxClass = options.boxClass ?? 'box box-' ~ admin_lte_context.widget.type ~ ' data_table' %}
{%- for title, headerOptions in columns -%} {% if not headerOptions is iterable %} {% set headerOptions = {'class': headerOptions} %} {% endif %} {% if not headerOptions.orderBy is defined %} {% if orderBy is same as(false) %} {% set headerOptions = headerOptions|merge({'orderBy': false}) %} {% else %} {% set headerOptions = headerOptions|merge({'orderBy': title}) %} {% endif %} {% endif %} {% set headerClass = _self.data_table_column_class(tableName, columns, title) %} {% if title != 'actions' and not headerOptions.orderBy is same as(false) %} {% if orderBy == headerOptions.orderBy %} {% set headerClass = headerClass ~ ' sortable sorting_' ~ (order) %} {% else %} {% set headerClass = headerClass ~ ' sortable sorting' %} {% endif %} {% endif %} {% set headerTitle = '' %} {% if headerOptions.title is defined %} {% set headerTitle = headerOptions.title %} {% elseif title is not empty and title != 'actions' %} {% set headerTitle = (translationPrefix ~ title)|trans({}, translationDomain) %} {% endif %} {%- endfor -%} {% endmacro %} {% macro data_table_column_class(name, columns, column) %} {% apply spaceless %} {% set class = '' %} {% set always = false %} {% if columns[column] is defined %} {% set classes = columns[column] %} {# change the next if, once data_table_header_options() will be deleted #} {% if classes is iterable %} {% set classes = classes.class %} {% endif %} {% if 'alwaysVisible' in classes %} {# as this column should always be visible, we remove every class that includes hidden #} {% for tmp in classes|split(' ') %} {% if 'hidden' not in tmp %} {% set class = class ~ ' ' ~ tmp %} {% endif %} {% endfor %} {% else %} {% if not is_visible_column(name, column, columns) %} {% set classes = classes ~ ' hidden' %} {% elseif not is_datatable_configured(name) %} {# needs to be a foreach, as classes like "hidden-xs" would match in: if 'hidden' in classes #} {% for tmp in classes|split(' ') %} {% if 'hidden' == tmp %} {% set classes = classes|replace({(tmp): ''}) %} {% endif %} {% endfor %} {% else %} {# needs to be a foreach, as classes like "hidden-xs" would match in: if 'hidden' in classes #} {% for tmp in classes|split(' ') %} {% if 'hidden' in tmp %} {% set classes = classes|replace({(tmp): ''}) %} {% endif %} {% endfor %} {% endif %} {% set class = classes %} {% endif %} {% endif %} {% if not class is empty %} {{ class }} {% endif %} {% endapply %} {% endmacro %} {% macro data_table_footer(entries, route, multi_update_form) %}
{% if headerOptions.html_before is defined %} {{ headerOptions.html_before|raw }} {% endif %} {{ headerTitle }} {% if headerOptions.html_after is defined %} {{ headerOptions.html_after|raw }} {% endif %}
{% if multi_update_form is not null %} {% endif %} {% if route is not empty and entries is not null%} {% endif %} {% endmacro %} {% macro datatable_meta_column(entry, field) %} {% import "macros/widgets.html.twig" as widgets %} {% set metaField = entry.metaField(field.name) %} {% if not metaField is null and metaField.value is not null and metaField.value is not empty %} {% set metaField = metaField.merge(field) %} {{ widgets.form_type_value(metaField.type, metaField.value, entry) }} {% endif %} {% endmacro %} {% macro datatable_multiupdate_all() %} {% endmacro %} {% macro datatable_multiupdate_row(id) %} {% endmacro %} {% macro data_table_header(name, columns, skipStripped, reloadEvent) %} {% deprecated 'The macro "data_table_header()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %} {{ _self.data_table_header_options(name, columns, {'skipStripped': skipStripped, 'reloadEvent': reloadEvent}) }} {% endmacro %} {% macro data_table_header_options(name, columns, options) %} {% deprecated 'The macro "data_table_header_options()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %} {% set skipStripped = options.skipStripped|default(true) %} {% set reloadEvent = options.reloadEvent|default('') %} {% set translationDomain = options.translationDomain|default('messages') %} {# |default does not work here, as the prefix might be an empty string #} {% set translationPrefix = 'label.' %} {% if options.translationPrefix is defined %} {% set translationPrefix = options.translationPrefix %} {% endif %}
{%- for title, class in columns -%} {%- endfor -%} {% endmacro %}
{% if title is not empty and title != 'actions' %}{{ (translationPrefix ~ title)|trans({}, translationDomain) }}{% endif %}