'; } public static function tag() { return 'div'; } public static function tagOptions() { return []; } public static function tagControlPath() { return false; } public static function name() { return 'FC Mini Cart'; } public static function className() { return 'fcbd-fc-mini-cart-element'; } public static function category() { return 'fluentcart'; } public static function badge() { return ['label' => 'FC', 'backgroundColor' => '#3157d5', 'textColor' => '#fff']; } public static function slug() { return __CLASS__; } public static function template() { return file_get_contents(__DIR__ . '/html.twig'); } public static function defaultCss() { return file_get_contents(__DIR__ . '/default.css'); } public static function cssTemplate() { return ControlPresets::buttonCssSnippet('%%SELECTOR%% .fct-mini-cart-button', 'design.trigger') . file_get_contents(__DIR__ . '/css.twig'); } public static function defaultChildren() { return false; } public static function dependencies() { return \FluentCartBreakdance\Compatibility\AssetManager::fcMiniCartDependencies(); } public static function settingsControls() { return []; } public static function settings() { return ['proOnly' => false]; } public static function availableIn() { return ['breakdance']; } public static function propertyPathsToSsrElementWhenValueChanges() { return ['content.cart']; } public static function defaultProperties() { return ['content' => ['cart' => [ 'mode' => 'dropdown', 'cart_icon' => 'bag', 'show_item_count' => 'has_items', 'show_total_price' => true, 'count_mode' => 'distinct_products', 'auto_open_on_add' => true, 'drawer_position' => 'right', ]]]; } public static function contentControls() { return [c('cart', __('Mini cart', 'sparkcore-commerce'), [ c('mode', __('Mode', 'sparkcore-commerce'), [], ['type' => 'dropdown', 'layout' => 'inline', 'items' => [ ['value' => 'dropdown', 'text' => __('FluentCart cart drawer (native)', 'sparkcore-commerce')], ['value' => 'drawer', 'text' => __('Own styled drawer', 'sparkcore-commerce')], ]], false, false, []), c('cart_icon', __('Icon', 'sparkcore-commerce'), [], ['type' => 'dropdown', 'layout' => 'inline', 'items' => [ ['value' => 'cart', 'text' => __('Cart', 'sparkcore-commerce')], ['value' => 'bag', 'text' => __('Bag', 'sparkcore-commerce')], ['value' => 'bag-alt', 'text' => __('Bag outline', 'sparkcore-commerce')], ]], false, false, []), c('show_item_count', __('Item count badge', 'sparkcore-commerce'), [], ['type' => 'dropdown', 'layout' => 'inline', 'items' => [ ['value' => 'always', 'text' => __('Always', 'sparkcore-commerce')], ['value' => 'has_items', 'text' => __('When populated', 'sparkcore-commerce')], ['value' => 'never', 'text' => __('Never', 'sparkcore-commerce')], ]], false, false, []), c('show_total_price', __('Show total price', 'sparkcore-commerce'), [], ['type' => 'toggle', 'layout' => 'inline'], false, false, []), c('count_mode', __('Count', 'sparkcore-commerce'), [], ['type' => 'dropdown', 'layout' => 'inline', 'items' => [ ['value' => 'distinct_products', 'text' => __('Distinct products', 'sparkcore-commerce')], ['value' => 'total_quantity', 'text' => __('Total quantity', 'sparkcore-commerce')], ]], false, false, []), c('auto_open_on_add', __('Auto-open drawer after add to cart', 'sparkcore-commerce'), [], ['type' => 'toggle', 'layout' => 'inline'], false, false, []), c('drawer_position', __('Drawer position', 'sparkcore-commerce'), [], ['type' => 'dropdown', 'layout' => 'inline', 'items' => [ ['value' => 'right', 'text' => __('Right', 'sparkcore-commerce')], ['value' => 'left', 'text' => __('Left', 'sparkcore-commerce')], ]], false, false, []), c('live_preview', __('Live editor preview', 'sparkcore-commerce'), [], ['type' => 'toggle', 'layout' => 'inline'], false, false, []), ], ['type' => 'section', 'layout' => 'vertical'], false, false, [])]; } /** * Tokens-first (docs/element-authoring.md): `ControlPresets::buttonSection()` * is reused verbatim for the trigger button (its shape is generic and * already parameterized by selector/control-path in its matching * `buttonCssSnippet()`). The badge/drawer-panel/drawer-overlay/line-items * sections below are LOCAL to this element (not added to the shared * ControlPresets.php, a read-only dependency for this fork): they target * FluentCart's own real markup classes (`.fct-mini-cart-badge`, * `.fct-cart-drawer`, `.fct-cart-drawer-list`, ...), not this plugin's own * `fcbd-*` class convention that ControlPresets' generic snippets assume, * so a byte-for-byte reuse of e.g. `typographySection()`'s CSS snippet * would target selectors that do not exist in this element's real DOM. * Every local section still consumes an EXISTING `--bde-fc-*` token * (badge -> the `badges` family's sale tokens, drawer/line-items -> the * `drawer` family, WP11A) via `ControlPresets::tokenVar()`, never a new * token name (docs/tokens.md par. 4). Flagged for the integrator: if a * later fork needs the same "real FluentCart markup, not fcbd-* classes" * shape, hoisting these four local sections into ControlPresets.php in an * integration commit would let them share this exact pattern too. */ public static function designControls() { return [ ControlPresets::buttonSection('trigger', __('Trigger button', 'sparkcore-commerce')), controlSection('badge', __('Item count badge', 'sparkcore-commerce'), [ control('background', __('Background', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('text_color', __('Text color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), ]), controlSection('drawer_panel', __('Drawer panel', 'sparkcore-commerce'), [ control('background', __('Background', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('text_color', __('Text color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('heading_color', __('Heading color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('border_color', __('Border color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('width', __('Panel width', 'sparkcore-commerce'), ['type' => 'unit', 'layout' => 'inline']), ]), controlSection('drawer_overlay', __('Drawer overlay', 'sparkcore-commerce'), [ control('overlay_color', __('Overlay color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('close_icon_color', __('Close icon color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), ]), controlSection('line_items', __('Line items', 'sparkcore-commerce'), [ control('title_color', __('Title color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('text_color', __('Text color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), control('divider_color', __('Divider color', 'sparkcore-commerce'), ['type' => 'color', 'layout' => 'inline']), ]), ]; } }