From c1459b48673eefb6ddbe24ac165045cb7e2cc01b Mon Sep 17 00:00:00 2001 From: mokaddem Date: Fri, 30 Jul 2021 11:45:44 +0200 Subject: [PATCH] chg: [setting] List settings that triggered a notice --- templates/element/Settings/notice.php | 49 ++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/templates/element/Settings/notice.php b/templates/element/Settings/notice.php index 7a8a2e5..6ae86c1 100644 --- a/templates/element/Settings/notice.php +++ b/templates/element/Settings/notice.php @@ -15,6 +15,9 @@ $noticeDescriptionPerLevel = [ 'info' => __('There are some optional tweaks that could be done to improve the looks of your Cerebrate instance.'), ]; +$settingNoticeListHeader = []; +$settingNoticeList = []; + $alertVariant = 'info'; $skipHeading = false; $alertBody = ''; @@ -33,6 +36,40 @@ foreach (array_keys($mainNoticeHeading) as $level) { 'badge-variant' => $variant, 'description' => $noticeDescriptionPerLevel[$level], ]; + $settingNoticeListHeader[] = $level; + $settingNoticeList[] = $this->Bootstrap->table([ + 'small' => true, + 'striped' => false, + 'hover' => false, + 'borderless' => true, + 'bordered' => false, + ], [ + 'fields' => [ + ['key' => 'name', 'label' => __('Name'), 'formatter' => function($name, $row) { + $settingID = $row['true-name']; + return sprintf('%s', h($settingID), h($settingID), h($name)); + }], + ['key' => 'setting-path', 'label' => __('Category'), 'formatter' => function($path, $row) { + return '' . h(str_replace('.', ' ▸ ', $path)) . ''; + }], + ['key' => 'value', 'label' => __('Value'), 'formatter' => function($value, $row) { + $formatedValue = '
';
+                    if (is_null($value)) {
+                        $formatedValue .= '' . __('No value') . '';
+                    } else if ($value === '') {
+                        $formatedValue .= '' . __('Empty string') . '';
+                    } else if (is_bool($value)) {
+                        $formatedValue .= '' . ($value ? __('true') : __('false')) . '';
+                    } else {
+                        $formatedValue .= h($value);
+                    }
+                    $formatedValue .= '
'; + return $formatedValue; + }], + ['key' => 'description', 'label' => __('Description')] + ], + 'items' => $notices[$level], + ]); } } @@ -63,4 +100,14 @@ $settingNotice = $this->Bootstrap->alert([ 'html' => $alertBody ]); $settingNotice = sprintf('
%s
', $settingNotice); -echo $settingNotice; \ No newline at end of file +echo $settingNotice; + +$tabsOptions = [ + 'card' => true, + 'pills' => false, + 'data' => [ + 'navs' => $settingNoticeListHeader, + 'content' => $settingNoticeList + ] +]; +echo $this->Bootstrap->tabs($tabsOptions);