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

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.3.20. 59 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.3.20/code/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.3.20/raw/app/Hooks/Handlers/BlockEditors/SearchBarBlockEditor.php
- Modified: 2026-03-13T16:10:00+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.3.20/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');

        $url_mode = !empty($urlMode) ? 'url_mode=' . $urlMode : 'url_mode=new-tab';
        $category_mode = !empty($categoryMode) ? 'category_mode=' . $categoryMode : '';
        $link_with_shop_app = !empty($linkWithShopApp) ? 'link_with_shop_app=' . $linkWithShopApp : '';

        $shortcodeName = SearchBarShortCode::getShortCodeName();
        return "[$shortcodeName $url_mode $category_mode $link_with_shop_app]";
    }

}

```
