{% for column in table_options.visible_columns %}
|
{% if table_options.columns[column].type is empty %}
- {{ columns[column] }}
+ {{ tablemacros.column(columns, table_options.columns[column].column)|trim }}
{% elseif table_options.columns[column].type == 'boolean' %}
- {{ tablemacros.boolean(columns[column]) }}
+ {{ tablemacros.boolean(tablemacros.column(columns, table_options.columns[column].column)|trim) }}
{% elseif table_options.columns[column].type == 'usage' %}
- {{ tablemacros.usage(columns[column]) }}
+ {{ tablemacros.usage(tablemacros.column(columns, table_options.columns[column].column)|trim) }}
{% endif %}
|
{% endfor %}
diff --git a/templates/Froxlor/table/tablemacros.html.twig b/templates/Froxlor/table/tablemacros.html.twig
index 7a131b57..b8af8ba8 100644
--- a/templates/Froxlor/table/tablemacros.html.twig
+++ b/templates/Froxlor/table/tablemacros.html.twig
@@ -1,4 +1,5 @@
{% macro contextual_class(contextual_class, columns) %}
+ {# this could be refactored as filter #}
{% for i_key,i_column in columns %}
{% for c_key, c_column in contextual_class %}
{% if i_key == c_key %}
@@ -12,7 +13,6 @@
{{ c_column.return }}
{% endif %}
{% elseif c_column.column is not empty %}
- check for {{ columns[c_column.column] }}
{# check for column #}
{% if c_column.operator is empty and columns[c_column.column] == i_column %}
{{ c_column.return }}
@@ -37,4 +37,17 @@
{% macro usage(value) %}
{{ value }}
+{% endmacro %}
+
+{% macro column(arr, str) %}
+ {# this could be refactored as filter #}
+ {% set strarr = str|split('.') %}
+
+ {% if strarr|length == 1 %}
+ {{ arr[strarr[0]] }}
+ {% elseif strarr|length == 2 %}
+ {{ arr[strarr[0]][strarr[1]] }}
+ {% else %}
+ column depth not supported
+ {% endif %}
{% endmacro %}
\ No newline at end of file
diff --git a/templates/Froxlor/user/table.html.twig b/templates/Froxlor/user/table.html.twig
index c0f6c35f..c47cdeeb 100644
--- a/templates/Froxlor/user/table.html.twig
+++ b/templates/Froxlor/user/table.html.twig
@@ -4,6 +4,6 @@
{% import "Froxlor/table/table.html.twig" as table %}
- {{ table.table(table_options, api_response, '#', table_options.title) }}
+ {{ table.table(table_options, collection, '#', table_options.title) }}
{% endblock %}