← All changes
|
app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php
+9
-8
1.3.21
→
1.7.0
View file →
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentCart\App\Hooks\Handlers\BlockEditors; |
| 4 | 4 | |
| 5 | +use FluentCart\App\Helpers\Helper; | |
| 5 | 6 | use FluentCart\App\Hooks\Handlers\ShortCodes\SearchBarShortCode; |
| 6 | 7 | use FluentCart\App\Services\Translations\TransStrings; |
| 7 | -use FluentCart\App\Vite; | |
| 8 | 8 | use FluentCart\Framework\Support\Arr; |
| 9 | 9 | |
| 10 | 10 | class SearchBarBlockEditor extends BlockEditor |
| 11 | 11 | { |
| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | 'name' => static::getEditorName(), |
| 35 | 35 | 'title' => __('Product Search', 'fluent-cart'), |
| 36 | 36 | ], |
| 37 | 37 | 'fluent_cart_block_editor_asset' => [ |
| 38 | - 'placeholder_image' => Vite::getAssetUrl('images/placeholder.svg'), | |
| 38 | + 'placeholder_image' => Helper::getProductPlaceholderUrl(), | |
| 39 | 39 | ], |
| 40 | 40 | 'fluent_cart_block_translation' => TransStrings::blockStrings() |
| 41 | 41 | ]; |
| 42 | 42 | } |
| @@ -45,14 +45,15 @@ | ||
| 45 | 45 | { |
| 46 | 46 | $urlMode = Arr::get($shortCodeAttribute, 'url_mode'); |
| 47 | 47 | $categoryMode = Arr::get($shortCodeAttribute, 'category_mode'); |
| 48 | 48 | $linkWithShopApp = Arr::get($shortCodeAttribute, 'link_with_shop_app'); |
| 49 | + $showThumbnail = Arr::get($shortCodeAttribute, 'show_thumbnail', true); | |
| 49 | 50 | |
| 50 | - $url_mode = !empty($urlMode) ? 'url_mode=' . $urlMode : 'url_mode=new-tab'; | |
| 51 | - $category_mode = !empty($categoryMode) ? 'category_mode=' . $categoryMode : ''; | |
| 52 | - $link_with_shop_app = !empty($linkWithShopApp) ? 'link_with_shop_app=' . $linkWithShopApp : ''; | |
| 53 | - | |
| 54 | - $shortcodeName = SearchBarShortCode::getShortCodeName(); | |
| 55 | - return "[$shortcodeName $url_mode $category_mode $link_with_shop_app]"; | |
| 51 | + return SearchBarShortCode::make([ | |
| 52 | + 'url_mode' => !empty($urlMode) ? $urlMode : 'new-tab', | |
| 53 | + 'category_mode' => !empty($categoryMode) ? $categoryMode : '', | |
| 54 | + 'link_with_shop_app' => !empty($linkWithShopApp) ? $linkWithShopApp : '', | |
| 55 | + 'show_thumbnail' => $showThumbnail, | |
| 56 | + ])->renderShortcode($block); | |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | 59 | } |