From 75a097a018a0090f5902758353c578fce4aa2a25 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sat, 23 May 2026 18:43:42 +0000
Subject: [PATCH] =CustomBlocks.php overhaul relatively complete. Also refactored the gallery in gallery.min.js and the jvbRenderGallery.
---
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