| 1 |
<?php |
| 2 |
namespace FluentCart\App\Services\Renderer; |
| 3 |
|
| 4 |
use FluentCart\Api\StoreSettings; |
| 5 |
use FluentCart\App\Models\Product; |
| 6 |
|
| 7 |
class ProductModalRenderer |
| 8 |
{ |
| 9 |
protected $product; |
| 10 |
protected $config = []; |
| 11 |
protected $storeSettings; |
| 12 |
|
| 13 |
public function __construct(Product $product, $config = []) |
| 14 |
{ |
| 15 |
$this->product = $product; |
| 16 |
$this->config = $config; |
| 17 |
$this->storeSettings = new StoreSettings(); |
| 18 |
} |
| 19 |
|
| 20 |
public function render() |
| 21 |
{ |
| 22 |
?> |
| 23 |
<div |
| 24 |
class="fct-product-modal" |
| 25 |
data-fluent-cart-shop-app-single-product-modal |
| 26 |
role="dialog" |
| 27 |
aria-modal="true" |
| 28 |
aria-label="<?php esc_attr($this->product->post_title); ?>" |
| 29 |
> |
| 30 |
<div |
| 31 |
data-fluent-cart-shop-app-single-product-modal-overlay |
| 32 |
class="fct-product-modal-overlay" |
| 33 |
role="presentation" |
| 34 |
aria-hidden="true" |
| 35 |
> |
| 36 |
</div> |
| 37 |
<div class="fct-product-modal-body"> |
| 38 |
<button |
| 39 |
class="fct-product-modal-close" |
| 40 |
data-fluent-cart-shop-app-single-product-modal-close |
| 41 |
type="button" |
| 42 |
aria-label="<?php esc_attr_e('Close product modal', 'fluent-cart'); ?>" |
| 43 |
> |
| 44 |
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"> |
| 45 |
<path d="M12.8337 1.16663L1.16699 12.8333M1.16699 1.16663L12.8337 12.8333" stroke="#2F3448" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 46 |
</svg> |
| 47 |
</button> |
| 48 |
|
| 49 |
<?php |
| 50 |
(new ProductRenderer($this->product, [ |
| 51 |
'view_type' => $this->storeSettings->get('variation_view', 'both'), |
| 52 |
'column_type' => $this->storeSettings->get('variation_columns', 'masonry') |
| 53 |
]))->render(); |
| 54 |
?> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
<?php |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
} |
| 62 |
|