__('3D Model', '3d-viewer'), 'link' => self::url($id, is_array($context) ? (string) ($context['base_url'] ?? '') : ''), ]; return $items; } public function enqueue(): void { if (!current_user_can('edit_posts')) { return; } $hooks = 'fluent-cart_global_admin_hooks'; $asset = EnqueueAssets::buildAsset('fluentcart-admin'); $deps = isset($asset['dependencies']) && is_array($asset['dependencies']) ? $asset['dependencies'] : ['wp-element', 'wp-components', 'wp-i18n']; // Must run before FluentCart's app reads the `fluent_cart_routes` filter; its app is a deferred module. if (!FluentCart::enqueue('fluentcart-admin', FluentCart::ADMIN_HANDLE, array_merge($deps, [$hooks]))) { return; } wp_enqueue_media(); wp_enqueue_style('wp-components'); wp_set_script_translations(FluentCart::ADMIN_HANDLE, '3d-viewer', BP3D_PATH . 'languages'); wp_localize_script(FluentCart::ADMIN_HANDLE, 'bp3dFluentCart', [ 'tier' => 'basic', 'routeName' => self::MENU_KEY, 'routePath' => self::ROUTE_PATH, 'restUrl' => rest_url(Rest::NAMESPACE . '/product/'), 'nonce' => wp_create_nonce('wp_rest'), // Loaded by the tab on first open, not on every FluentCart screen. 'modelViewerSrc' => BP3D_DIR . 'public/js/model-viewer.latest.min.js?ver=' . BP3D_VERSION, 'positions' => ProductModel::positionLabels(), 'modelTypes' => Utils::modelLibraryTypes(), 'modelExtensions' => Utils::modelExtensions(), 'heightDefault' => ProductModel::HEIGHT_DEFAULT, 'heightMin' => ProductModel::HEIGHT_MIN, 'heightMax' => ProductModel::HEIGHT_MAX, ]); } }