From 95871f326fbe308a14025ac911bd0aec4366ce7c Mon Sep 17 00:00:00 2001 From: Niclas Date: Fri, 10 May 2024 11:54:24 +0200 Subject: [PATCH] fix: faulty button params --- source/php/Module/Products.php | 6 ------ source/php/Module/views/products.blade.php | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/php/Module/Products.php b/source/php/Module/Products.php index 9843298..50b1470 100644 --- a/source/php/Module/Products.php +++ b/source/php/Module/Products.php @@ -54,12 +54,6 @@ public function data(): array if (!empty($product['image'])) { $product['image']['url'] = wp_get_attachment_image_url($product['image']['id'], [128, 128]); } - - if (!empty($product['button']) && !empty($product['button']['label'])) { - $product['button']['text'] = $product['button']['label']; - } else { - $product['button'] = false; - } } return $data; diff --git a/source/php/Module/views/products.blade.php b/source/php/Module/views/products.blade.php index 6615c13..02c21b2 100644 --- a/source/php/Module/views/products.blade.php +++ b/source/php/Module/views/products.blade.php @@ -21,7 +21,10 @@ 'meta' => $product['metaText'] ?? '', 'prices' => $product['prices'], 'bulletPoints' => $product['bulletPoints'], - 'button' => $product['button'], + 'button' => !empty($product['button']['label']) ? [ + 'text' => $product['button']['label'], + 'href' => $product['button']['href'] ?? null + ] : null, 'featured' => $product['featured'], 'attributeList' => $product['backgroundColor'] === 'custom' ? [ 'style' => '--c-product-custom-color: ' . $product['customColor'] . ';'