PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / trunk
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler vtrunk
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Hooks / Handlers / BlockEditors / CustomerDashboardButtonBlockEditor.php

CustomerDashboardButtonBlockEditor.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler trunk, at app/Hooks/Handlers/BlockEditors/CustomerDashboardButtonBlockEditor.php

98 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Hooks\Handlers\BlockEditors;
4
5 use FluentCart\App\Services\Renderer\CustomerDashboardButtonRenderer;
6 use FluentCart\App\Services\Translations\TransStrings;
7 use FluentCart\App\Vite;
8
9 class CustomerDashboardButtonBlockEditor extends BlockEditor
10 {
11 protected static string $editorName = 'customer-dashboard-button';
12
13 public function getScripts(): array
14 {
15 return [
16 [
17 'source' => 'admin/BlockEditor/CustomerDashboardButton/CustomerDashboardButtonBlockEditor.jsx',
18 'dependencies' => ['wp-blocks', 'wp-components']
19 ]
20 ];
21 }
22
23 public function getStyles(): array
24 {
25 return [
26 'admin/BlockEditor/CustomerDashboardButton/style/customer-dashboard-button-block-editor.scss'
27 ];
28 }
29
30 public function supports(): array
31 {
32 return [
33 'html' => false,
34 'typography' => [
35 'fontSize' => true,
36 'fontFamily' => true,
37 'fontWeight' => true,
38 'lineHeight' => true
39 ],
40 'color' => [
41 'text' => true,
42 'background' => true
43 ],
44 'spacing' => [
45 'margin' => true,
46 'padding' => true
47 ],
48 '__experimentalBorder' => [
49 'color' => true,
50 'radius' => true,
51 'width' => true,
52 'style' => true,
53 '__experimentalDefaultControls' => [
54 'color' => true,
55 'radius' => true,
56 'width' => true
57 ]
58 ],
59 'border' => [
60 'color' => true,
61 'radius' => true,
62 'width' => true,
63 'style' => true
64 ],
65 'shadow' => true
66 ];
67 }
68
69 public function localizeData(): array
70 {
71 return [
72 $this->getLocalizationKey() => [
73 'slug' => $this->slugPrefix,
74 'name' => static::getEditorName(),
75 'title' => __('Customer Dashboard Button', 'fluent-cart'),
76 'description' => __('Display a button or link that navigates to the customer dashboard.', 'fluent-cart'),
77 ],
78 'fluent_cart_block_translation' => TransStrings::blockStrings(),
79 ];
80 }
81
82 public function render(array $shortCodeAttribute, $block = null)
83 {
84 $slug = fluentCart()->config->get('app.slug');
85
86 Vite::enqueueStyle(
87 $slug . '-customer-dashboard-button',
88 'public/customer-dashboard-button/customer-dashboard-button.scss'
89 );
90
91 $renderer = new CustomerDashboardButtonRenderer();
92
93 ob_start();
94 $renderer->render($shortCodeAttribute);
95 return ob_get_clean();
96 }
97 }
98