From a9654f00c8fbc9934289d761843ddd071025013f Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 28 Aug 2026 17:20:28 +0000
Subject: [PATCH] =PHPStorm Code Inspection: fixed class reference errors (from getting rid of JVB() and replacing with direct class::getInstance; as well as general code sniffing, etc
---
inc/blocks/MenuBlock.php | 103 +++++++++++++++++++++++++++++++--------------------
1 files changed, 62 insertions(+), 41 deletions(-)
diff --git a/inc/blocks/MenuBlock.php b/inc/blocks/MenuBlock.php
index 24d3759..22ba279 100644
--- a/inc/blocks/MenuBlock.php
+++ b/inc/blocks/MenuBlock.php
@@ -4,10 +4,7 @@
use JVBase\base\Options;
use JVBase\base\Site;
use JVBase\managers\Cache;
-use JVBase\forms\TaxonomySelector;
-use JVBase\meta\Form;
use JVBase\meta\Meta;
-use JVBase\meta\Render;
use WP_Block;
use WP_Query;
@@ -215,54 +212,78 @@
<div>
<h4>%s — %s</h4>
%s
- </div>', //Note: we had 3 %s%s%s before the last </div> last time. This was to add optional ingredients or preparation time duration, not default in WooCommerce
+ </div><a href="?add-to-cart=%d&variation_id=%d"
+ data-quantity="1"
+ data-product_id="%d"
+ data-variation_id="%d"
+ class="btn chip add_to_cart_button ajax_add_to_cart add-to-cart">
+ %s
+ <span>Add to Cart</span>
+</a>', //Note: we had 3 %s%s%s before the last </div> last time. This was to add optional ingredients or preparation time duration, not default in WooCommerce
$row['title'],
jvbCurrency($row['price']),
empty($row['description']) ? '' : wpautop($row['description']),
+ $ID,
+ $row['id'],
+ $ID,
+ $row['id'],
+ jvbIcon('plus-square')
);
- $out .= Form::render(
- $row['id'],
- '',
- [
- 'type' => 'quantity',
- 'label' => $row['title'],
- 'min' => 0,
- 'max' => 30,
- 'data' => [
- 'price' => $row['price'],
- 'id' => $row['id'],
- 'sku' => $row['sku'],
- 'name' => $row['title'],
- 'add-to-cart' => ''
- ],
- 'add' => 'Add 1 '.$row['title'].' to cart',
- 'remove' => 'Remove 1 '.$row['title']. ' from cart',
- ]
- );
+// $out .= Form::render(
+// $row['id'],
+// '',
+// [
+// 'type' => 'quantity',
+// 'label' => $row['title'],
+// 'min' => 0,
+// 'max' => 30,
+// 'data' => [
+// 'price' => $row['price'],
+// 'id' => $row['id'],
+// 'sku' => $row['sku'],
+// 'name' => $row['title'],
+// 'add-to-cart' => ''
+// ],
+// 'add' => 'Add 1 '.$row['title'].' to cart',
+// 'remove' => 'Remove 1 '.$row['title']. ' from cart',
+// ]
+// );
$out .= '</div>';
}
} else {
- $out .= Form::render(
+ $out .= sprintf(
+ '<a href="?add-to-cart=%d"
+ data-quantity="1"
+ data-product_id="%d"
+ class="btn chip add_to_cart_button ajax_add_to_cart add-to-cart">
+ %s
+ <span>Add to Cart</span>
+ </a>',
$ID,
- '',
- [
- 'type' => 'quantity',
- 'label' => 'Add to Order',
- 'min' => 0,
- 'max' => 30,
- 'step' => 1,
- 'data' => [
- 'price' => $fields['_price'],
- 'id' => $ID,
- 'name' => $fields['post_title'],
- 'step' => 1,
- 'add-to-cart' => '',
- ],
- 'add' => 'Add 1 '.$fields['post_title'].' to cart',
- 'remove' => 'Remove 1 '.$fields['title']. ' from cart',
- ]
+ $ID,
+ jvbIcon('plus-square')
);
+// $out .= Form::render(
+// $ID,
+// '',
+// [
+// 'type' => 'quantity',
+// 'label' => 'Add to Order',
+// 'min' => 0,
+// 'max' => 30,
+// 'step' => 1,
+// 'data' => [
+// 'price' => $fields['_price'],
+// 'id' => $ID,
+// 'name' => $fields['post_title'],
+// 'step' => 1,
+// 'add-to-cart' => '',
+// ],
+// 'add' => 'Add 1 '.$fields['post_title'].' to cart',
+// 'remove' => 'Remove 1 '.$fields['title']. ' from cart',
+// ]
+// );
}
$out .= '</div></div>';
--
Gitblit v1.10.0