# fluent-cart/1.5.2/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.5.2. 60 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.5.2/code/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.5.2/raw/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php
- Modified: 2026-06-24T14:03:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.5.2/code/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Hooks\Handlers\BlockEditors;

use FluentCart\App\Hooks\Handlers\ShortCodes\SearchBarShortCode;
use FluentCart\App\Services\Translations\TransStrings;
use FluentCart\App\Vite;
use FluentCart\Framework\Support\Arr;

class SearchBarBlockEditor extends BlockEditor
{
    protected static string $editorName = 'fluent-products-search-bar';

    public function getScripts(): array
    {
        return [
            [
                'source'       => 'admin/BlockEditor/SearchBar/SearchBarBlockEditor.jsx',
                'dependencies' => ['wp-blocks', 'wp-components']
            ]
        ];
    }

    public function getStyles(): array
    {
        return ['admin/BlockEditor/SearchBar/style/searchbar-block-editor.css'];
    }

    public function localizeData(): array
    {
        return [
            $this->getLocalizationKey()      => [
                'slug'  => $this->slugPrefix,
                'name'  => static::getEditorName(),
                'title' => __('Product Search', 'fluent-cart'),
            ],
            'fluent_cart_block_editor_asset' => [
                'placeholder_image' => Vite::getAssetUrl('images/placeholder.svg'),
            ],
            'fluent_cart_block_translation' => TransStrings::blockStrings()
        ];
    }

    public function render(array $shortCodeAttribute, $block = null): string
    {
        $urlMode = Arr::get($shortCodeAttribute, 'url_mode');
        $categoryMode = Arr::get($shortCodeAttribute, 'category_mode');
        $linkWithShopApp = Arr::get($shortCodeAttribute, 'link_with_shop_app');
        $showThumbnail = Arr::get($shortCodeAttribute, 'show_thumbnail', true);

        return SearchBarShortCode::make([
            'url_mode'           => !empty($urlMode) ? $urlMode : 'new-tab',
            'category_mode'      => !empty($categoryMode) ? $categoryMode : '',
            'link_with_shop_app' => !empty($linkWithShopApp) ? $linkWithShopApp : '',
            'show_thumbnail'     => $showThumbnail,
        ])->renderShortcode($block);
    }

}

```
