*/ public function get_categories(): array { return ['general']; } /** * Get widget keywords for search. * * @return array */ public function get_keywords(): array { return ['3d', '3d embed', '3d viewer', '3d model', 'model viewer', 'product model', 'product', 'woocommerce', 'glb', 'gltf', 'ar']; } /** * Get widget script dependencies. * * @return array */ public function get_script_depends(): array { return ['bp3d-public']; } /** * Get widget style dependencies. * * @return array */ public function get_style_depends(): array { return []; } /** * Register widget controls. */ protected function register_controls(): void { // Content Tab $this->start_controls_section('embedder', [ 'label' => esc_html__('Model Viewer', '3d-viewer'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ]); $this->end_controls_section(); // Style Tab $this->start_controls_section('model', [ 'label' => esc_html__('Model', '3d-viewer'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ]); $this->add_control('width', [ 'label' => esc_html__('Width', '3d-viewer'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', '%', 'vw'], 'range' => [ 'px' => ['min' => 0, 'max' => 1000, 'step' => 5], '%' => ['min' => 20, 'max' => 100], 'vw' => ['min' => 5, 'max' => 100], ], 'default' => ['unit' => '%', 'size' => 100], 'selectors' => [ '{{WRAPPER}} .b3dviewer model-viewer' => 'width: {{SIZE}}{{UNIT}};margin:0 auto;max-width:100%;', ], ]); $this->add_control('height', [ 'label' => esc_html__('Height', '3d-viewer'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', 'vh'], 'range' => [ 'px' => ['min' => 200, 'max' => 1000, 'step' => 5], 'vh' => ['min' => 5, 'max' => 100], ], 'default' => ['unit' => 'px', 'size' => 500], 'selectors' => [ '{{WRAPPER}} .b3dviewer model-viewer' => 'height: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .b3dviewer model-viewer #lazy-load-poster img' => 'height: {{SIZE}}{{UNIT}};', ], ]); $this->end_controls_section(); } /** * Render the widget output. */ protected function render(): void { Addons::ensureElementorDependencies(); echo do_shortcode('[3d_viewer_product]'); } }