← All changes
|
app/Hooks/Handlers/BlockEditors/PricingTableBlockEditor.php
+19
-19
1.3.21
→
1.7.0
View file →
| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | use FluentCart\App\App; |
| 6 | 6 | use FluentCart\App\Helpers\Helper; |
| 7 | 7 | use FluentCart\App\Hooks\Handlers\ShortCodes\PricingTableShortCode; |
| 8 | 8 | use FluentCart\App\Services\Translations\TransStrings; |
| 9 | -use FluentCart\App\Vite; | |
| 10 | 9 | use FluentCart\Framework\Support\Arr; |
| 11 | 10 | |
| 12 | 11 | class PricingTableBlockEditor extends BlockEditor |
| 13 | 12 | { |
| @@ -28,9 +27,12 @@ | ||
| 28 | 27 | } |
| 29 | 28 | |
| 30 | 29 | public function getStyles(): array |
| 31 | 30 | { |
| 32 | - return ['admin/BlockEditor/PricingTable/style/pricing-table-block-editor.scss']; | |
| 31 | + return [ | |
| 32 | + 'admin/BlockEditor/PricingTable/style/pricing-table-block-editor.scss', | |
| 33 | + 'admin/BlockEditor/Components/style/fct-global-block-editor.scss' | |
| 34 | + ]; | |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | 37 | public function localizeData(): array |
| 36 | 38 | { |
| @@ -42,9 +44,9 @@ | ||
| 42 | 44 | 'trans' => TransStrings::getShopAppBlockEditorString(), |
| 43 | 45 | 'title' => __('Pricing Table', 'fluent-cart'), |
| 44 | 46 | ], |
| 45 | 47 | 'fluent_cart_block_editor_asset' => [ |
| 46 | - 'placeholder_image' => Vite::getAssetUrl('images/placeholder.svg'), | |
| 48 | + 'placeholder_image' => Helper::getProductPlaceholderUrl(), | |
| 47 | 49 | ], |
| 48 | 50 | 'fluent_cart_block_translation' => TransStrings::blockStrings() |
| 49 | 51 | ]; |
| 50 | 52 | } |
| @@ -94,24 +96,22 @@ | ||
| 94 | 96 | |
| 95 | 97 | |
| 96 | 98 | $activeTab = Arr::get($shortCodeAttribute, 'active_tab', 0); |
| 97 | 99 | |
| 98 | - $code = "[" . PricingTableShortCode::SHORT_CODE . | |
| 99 | - " variant_ids='{$variantIds}'" . | |
| 100 | - " show_cart_button='{$showCartButton}'" . | |
| 101 | - " show_checkout_button='{$showCheckoutButton}'" . | |
| 102 | - " group_by='{$groupBy}'" . | |
| 103 | - " active_tab='{$activeTab}'" . | |
| 104 | - " active_variant='{$activeVariantString}'" . | |
| 105 | - " badge='{$badgeString}'" . | |
| 106 | - " colors='{$allColorStrings}'" . | |
| 107 | - " product_per_row='{$productPerRow}'" . | |
| 108 | - " button_options='{$buttonOptionStrings}'" . | |
| 109 | - " url_params='$checkoutButtonUrlParams'". | |
| 110 | - " icon_visibility='{$iconVisibility}'" . | |
| 111 | - " ]"; | |
| 112 | - | |
| 113 | - return $code; | |
| 100 | + return PricingTableShortCode::make([ | |
| 101 | + 'variant_ids' => $variantIds, | |
| 102 | + 'show_cart_button' => (string) $showCartButton, | |
| 103 | + 'show_checkout_button' => (string) $showCheckoutButton, | |
| 104 | + 'group_by' => $groupBy, | |
| 105 | + 'active_tab' => $activeTab, | |
| 106 | + 'active_variant' => $activeVariantString, | |
| 107 | + 'badge' => $badgeString, | |
| 108 | + 'colors' => $allColorStrings, | |
| 109 | + 'product_per_row' => $productPerRow, | |
| 110 | + 'button_options' => $buttonOptionStrings, | |
| 111 | + 'url_params' => $checkoutButtonUrlParams, | |
| 112 | + 'icon_visibility' => (string) $iconVisibility, | |
| 113 | + ])->renderShortcode($block); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | private function assocArrayToString(array $array, string $delimiter = ', '): string |
| 117 | 117 | { |