From 695fcdaf267038bbe0ba79b37ab86eb75420ae2e Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 21 Jan 2022 09:08:13 +0100 Subject: [PATCH] chg: [genericELements:index_table] Tabler head accept icons --- .../genericElements/IndexTable/headers.php | 20 +++++++++++++++++-- .../IndexTable/index_table.php | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/templates/element/genericElements/IndexTable/headers.php b/templates/element/genericElements/IndexTable/headers.php index b949d12..ddacc54 100644 --- a/templates/element/genericElements/IndexTable/headers.php +++ b/templates/element/genericElements/IndexTable/headers.php @@ -3,11 +3,27 @@ foreach ($fields as $k => $header) { if (!isset($header['requirement']) || $header['requirement']) { $header_data = ''; + $icon_html = ''; + if (!empty($header['icon'])) { + $icon_html = $this->Bootstrap->icon($header['icon'], ['class' => ['d-inline me-1']]); + } if (!empty($header['sort'])) { if (!empty($header['name'])) { - $header_data = $paginator->sort($header['sort'], $header['name']); + $header_data = $paginator->sort( + $header['sort'], + sprintf('%s%s', $icon_html, h($header['name'])), + ['escape' => false] + ); } else { - $header_data = $paginator->sort($header['sort']); + if (empty($icon_html)) { + $header_data = $paginator->sort($header['sort']); + } else { + $header_data = $paginator->sort( + $header['sort'], + $icon_html, + ['escape' => false] + ); + } } } else { if (!empty($header['element']) && $header['element'] === 'selector') { diff --git a/templates/element/genericElements/IndexTable/index_table.php b/templates/element/genericElements/IndexTable/index_table.php index 114c9d9..dc7453c 100644 --- a/templates/element/genericElements/IndexTable/index_table.php +++ b/templates/element/genericElements/IndexTable/index_table.php @@ -42,7 +42,7 @@ if (!empty($data['title'])) { echo Text::insert( '

:title :help

', [ - 'title' => h($data['title']), + 'title' => $this->ValueGetter->get($data['title']), 'help' => $this->Bootstrap->icon('info', [ 'class' => ['fs-6', 'align-text-top',], 'title' => empty($data['description']) ? '' : h($data['description']),