Skip to content

Commit

Permalink
Merge pull request #10 from helsingborg-stad/fix/faulty-buttom-params
Browse files Browse the repository at this point in the history
fix: faulty button params
  • Loading branch information
NiclasNorin authored May 10, 2024
2 parents b327529 + 95871f3 commit f35c2d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions source/php/Module/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion source/php/Module/views/products.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] . ';'
Expand Down

0 comments on commit f35c2d4

Please sign in to comment.