This commit is contained in:
2025-05-20 14:15:03 -07:00
parent c074a5ef18
commit edcad561a5
179 changed files with 52733 additions and 4704 deletions

View File

@@ -1,15 +0,0 @@
<?php
namespace Helpers;
class DateFormatter
{
public static function monthDayYear()
{
return function ($template, $context, $args, $source) {
$dateString = strtotime($context->get($args));
return date("M d, Y", $dateString);
};
}
}

52
helpers/McCansHelpers.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
namespace Helpers;
class McCansHelpers
{
public static function testimonial()
{
return function ($template, $context, $args, $source) {
$post = $context->get($args);
return site()->render('testimonial-block', site()->getPost($post, [
'title',
'thumbnail',
'position',
'quote',
'rating',
]));
};
}
public static function locationTile()
{
return function ($template, $context, $args, $source) {
return site()->render("location-tile", $context->get($args));
};
}
public static function productTile()
{
return function ($template, $context, $args, $source) {
$data = site()->getPost($context->get($args), [
"title",
"thumbnail",
"url",
"woocommerce.price",
"woocommerce.cartUrl",
"woocommerce.attribute.msrp",
]);
if ((float) $data["msrp"] && (float) $data["price"]) {
if ($data["price"] != 0) {
$difference = $data["msrp"] - $data["price"];
if ($difference > 0) {
$savingsPercent = round(($difference / $data["msrp"])*100);
}
$data["savings"] = $savingsPercent;
}
}
return site()->render("product-tile", $data);
};
}
}