From c4aa5cdb5e90ad4b420e22772797d16980232a2b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 15 Apr 2026 18:38:55 +0000
Subject: [PATCH] =Updating custom tables to utilize CustomTable.php

---
 inc/managers/EmailManager.php |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/inc/managers/EmailManager.php b/inc/managers/EmailManager.php
index f1c7e33..68bbdef 100644
--- a/inc/managers/EmailManager.php
+++ b/inc/managers/EmailManager.php
@@ -756,11 +756,35 @@
 		);
 	}
 
-	public function grid(array $items, int $columns = 2):string
+	public function grid(array $items, int $columns = 2, string $title = '', string|array $description = '', string $after = ''):string
 	{
 		$width = floor(100 / $columns) - 2; // 2% gap
 
-		$html = '<div style="display:table;width:100%;margin:20px 0;">';
+		$html = '';
+		if (!empty($title) || !empty($description)) {
+			$html .= '<div>';
+			if (!empty($title)) {
+				$html .= sprintf(
+					'<h2>%s</h2>',
+					$title
+				);
+			}
+			if (!empty($description)) {
+				if (is_string($description)) {
+					if (str_starts_with($description, '<p>')) {
+						$html .= $description;
+					}else {
+						$html .= sprintf(
+							'<p>%s</p>',
+							$description
+						);
+					}
+				} else {
+					$html .= implode('',array_map(function ($p) { return sprintf('<p>%s</p>', $p); }, $description));
+				}
+			}
+		}
+		$html .= '<div style="display:table;width:100%;margin:20px 0;">';
 		foreach ($items as $index => $item) {
 			if ($index > 0 && $index % $columns === 0) {
 				$html .= '</div><div style="display:table;width:100%;margin:20px 0;">';
@@ -771,11 +795,16 @@
 				$item
 			);
 		}
-		$html .= '</div>';
+		$html .= '</div>'.$after;
 
+
+		if (!empty($title) || !empty($description)) {
+			$html .= '</div>';
+		}
 		return $html;
 	}
 
+
 	public function image(string $src, string $alt = '', int $maxWidth = 600):string
 	{
 		return sprintf(

--
Gitblit v1.10.0