# fluent-cart/1.6.2/app/Hooks/Handlers/BlockEditors/CustomerProfileBlockEditor.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.2. 83 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.2/code/app/Hooks/Handlers/BlockEditors/CustomerProfileBlockEditor.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.2/raw/app/Hooks/Handlers/BlockEditors/CustomerProfileBlockEditor.php
- Modified: 2026-05-14T15:41:54+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.6.2/code/app/Hooks/Handlers/BlockEditors/CustomerProfileBlockEditor.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Hooks\Handlers\BlockEditors;

use FluentCart\App\Hooks\Handlers\ShortCodes\CustomerProfileHandler;
use FluentCart\Framework\Support\Arr;



class CustomerProfileBlockEditor extends BlockEditor
{
    protected static string $editorName = 'customer-profile';

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

    public function getStyles(): array
    {
        return ['admin/BlockEditor/CustomerProfile/style/customer-profile-block-editor.scss'];
    }

    public function localizeData(): array
    {
        return [
            $this->getLocalizationKey() => [
                'slug'  => $this->slugPrefix,
                'name'  => static::getEditorName(),
                'title' => __('Customer Dashboard', 'fluent-cart'),
            ]
        ];
    }

    public function render(array $shortCodeAttribute, $block = null): string
    {
        $defaultsTitles = [
            'purchaseHistory' => __('Purchase History', 'fluent-cart'),
            'subscriptions'   => __('Subscriptions', 'fluent-cart'),
            'licenses'        => __('Licenses', 'fluent-cart'),
            'downloads'       => __('Downloads', 'fluent-cart')
        ];

        $sectionTitles = Arr::get($shortCodeAttribute, 'sectionTitles', $defaultsTitles);
        $jsonTitles = wp_json_encode($sectionTitles);
        $colors = Arr::get($shortCodeAttribute, 'colors', []);



        $colorStrings = [];
        // Iterate over each color group (e.g., generalColors)
        foreach ($colors as $colorGroup) {
            // Iterate over each color within the color group
            foreach ($colorGroup as $key => $color) {
                $value = $color['value'];

                if (is_array($value)) {
                    // Convert box values (like padding/margin) to CSS shorthand string
                    $top = $value['top'] ?? '0';
                    $right = $value['right'] ?? '0';
                    $bottom = $value['bottom'] ?? '0';
                    $left = $value['left'] ?? '0';
                    $value = trim("$top $right $bottom $left");
                }
                // Append each color key and its value to the $colorStrings array
                $colorStrings[] = $key . '=' . $value;
            }
        }

        $allColorStrings = implode(', ', $colorStrings);

        return CustomerProfileHandler::make([
            'section_titles' => $jsonTitles,
            'colors'         => $allColorStrings,
        ])->renderShortcode($block);
    }
}

```
